Questions tagged [define]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Understanding define command with Scrabble lab

I fail to understand define command while taking a look at template code provided with Scrabble lab that does not have mention of define command. Since there is no TODO after #include, I guess define ...
user avatar
2 votes
1 answer
43 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 ...
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
user avatar
0 votes
2 answers
108 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 ...
user avatar
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 ...
user avatar
  • 3
0 votes
2 answers
452 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 ...
user avatar
3 votes
2 answers
3k 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 ...
user avatar
  • 17.4k