Monday, August 31, 2020

pre-processing

in this step, the pre-processor goes through your code, and copy pastes relevant code from .h header files into your code

for example:


#include <cs50.h>
#include <stdio.h>

int main(void)
{
string s = get_string("what is your name\n");
printf("hello, %s\n", s);
}


becomes

....
string get_string(string prompt);
void printf(string format, .....);
....

int main(void)
{
string s = get_string("what is your name\n");
printf("hello, %s\n", s);
}

.................the actual code pasted in is simplified here, but this is enough to illustrate the concept......





cs50, lec2






No comments:

Post a Comment