Skip to main content

Questions tagged [define]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
63 views

What is the usage of creating DICTIONARY_H in pset5?

I cann't understand when to use the preprocessor directives as (ifndef, define ,etc.)? In dictionary.h, what is the importance of writing those statements? and regarding the reason that was mentioned ...
Aya Othman's user avatar
0 votes
1 answer
88 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
Nitish Panda's user avatar
0 votes
2 answers
161 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 ...
Hari07's user avatar
  • 5
0 votes
2 answers
3k 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 ...
JakobH's user avatar
  • 3
0 votes
2 answers
588 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 ...
Eduardo Carrascosa's user avatar
3 votes
2 answers
4k 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 ...
kzidane's user avatar
  • 17.7k