Questions tagged [define]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
86 views

Why is const used in field.c of pset3?

What does the following code do in the find.c source code in pset3 const int MAX = 65536; Does it define a constant MAX with value 65536? If so, then is this same as writing : #Define MAX 65536
0
votes
2answers
101 views

Whats's difference between declaring and defining variables?

According to lectures all variables we use are declared as int x = something; or int x; But in pset3..in files that Cs50 staff made,they have done; #define DIM_MIN 3 and #define DIM_MAX 9 So ...
0
votes
2answers
2k views

Excess elements in scalar initilizer?

#include <cs50.h> #include <stdio.h> int example[]; int main(void) { int example = {1,2,3}; for (int i = 0; i < 3; i++) { printf("%i \n", example[i]); } } Why ...
0
votes
2answers
320 views

Declaration and Initialization gives error: unused variable

I am working on caesar's cipher and I am not done yet but below is my work in progress. I had done something similar and it was working all I needed to do is write some code to get it to wrap around ...
3
votes
2answers
2k views

Why do macros take more space than an equivalently defined function?

From Programming in C (3rd edition), page 309 Because macros are directly substituted into the program by the preprocessor, they inevitably use more memory space than an equivalently defined ...