Tuesday, March 2, 2010

A closer look at #define

Today as I was starting on assignment#2, I've found out that in a #define statement one can just call it's index like in an array.
e.g. #define whatever "abcde"
one can just code: whatever[1] and if called correctly it should output the letter b.

Besides what I've just mentioned, however, we also needed to use this character: \ or the backslash in the define statement.
And what I've found out is that anytime one see the first \ it probably acts like Pearl's escapes, escaping the next character, but I think it's using printf's forward declaration or some sort to see what's the next character and if it is: either an n, t, b, etc. the backslash will escape those key letters representing newline, tab, beep respectively including itself all together; else it will probably just escape itself.  In this case the missing \ in index [0, 2, 4, 7, 9, 11, 13, 18] shows the escaping itself effect and the \n escaping both the backslash and the n, all together, because of the key-letter n.   Hoping I've concluded this correctly...
Try this code:
#define WHATEVER "abcde"
#define INDEX_CHARS "\\\!\/-\\\\\\\\|/-\\|"
#include <stdio.h>
void main(void){
    printf("%c\n", WHATEVER[1]);
    printf("\\\!\/-\\\\\\\\|/-\\| \n");
    printf("%s\n", INDEX_CHARS);
}
And the outcome is:

Saturday, January 30, 2010

oop344 - ver0.01 minor Borland compilation error






Am running into a minor compilation error of not finding the 'conio.h' header file, which I'd checked in the C:\Borland\BCC55\Include and it is there. I'd even made a copy and put it in C:\Borland\BCC55\Bin with the rest of the biomain.c biof.c and biof.h but still same error.


Am I missing something here?

Tuesday, January 12, 2010

Course Repeat

This will be my second semester with Fardad doing oop344, which I'm gladly to be repeating. My programming skills will therefore be improving as I'll practice more and more and optimistically hoping, I'll pass this C++ course, now open source, with flying colors.

Sunday, November 1, 2009

First IRC Meeting

Our 1st IRC meeting basically is to understand and respect the rules normally set way back when IRC meetings first began. The rules can be reviewed from most of our teammates. e.g. Istessema's Blog.

As for our second meeting, we didn't accomplished much or rather made any major changes to the AS2. Besides the Halloween party, pretty much we have to do some self study for the upcoming exam. And to best prepare for it is to pratice with the IntStack, DsStack, & Link_List challenges.

Thursday, September 24, 2009

OOP344C

I have no contributions yet...