what is the use of # in including header file..?? what it mean #..?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

what is the use of # in including header file..?? what it mean #..??

7th Sep 2018, 2:57 PM
Sowmiya
Sowmiya - avatar
20 Answers
+ 2
simply put, '#' is the language syntax (c,c++ etc) for commanding the preprocessor to include a file. it is like 'import' in python. the c/c++ preprocessor/compilers are coded to recognize '#' character alone as a directive and not any other fancy character like '??'. if you were to create your own language, you could define '??' as your preprocessor directive so that when the compiler sees it, the it knows what to do. it was just a choice by the language creator(s)
8th Sep 2018, 3:23 AM
Michael Joseph Jaroya
Michael Joseph Jaroya - avatar
+ 4
Simply, we can say that # is a linker. It links any file which is situated outside of a program ( in C libraries). It is a special symbol. It is not an operator but we can say so.. Hope you understand.😁😁😁
8th Sep 2018, 8:41 AM
Daksh Beniwal
Daksh Beniwal - avatar
9th Sep 2018, 3:06 PM
Daksh Beniwal
Daksh Beniwal - avatar
+ 4
# is used to write compiler code, this is actually not interpreted as c++ code. the # preprocessor directive is used to tell the compiler stuffs to do to make your program compile successfully. eg: including a header file #include <iostream> eg: conditional compilation #ifdef OS_WINDOWS #define WIN_RS 0x0551 #if WIN_RS < 0x0552 #warning platform may not be supported! #endif #endif eg: defining symbolic Constants #define PI 3.142 eg: writing header file guard #ifndef MY_FILE_H #define MY_FILE_H //file class definition goes here #endif
9th Sep 2018, 5:30 PM
Germain F
Germain F - avatar
+ 3
to all now...👍
9th Sep 2018, 12:14 PM
Sweet heart
Sweet heart - avatar
+ 3
accept the challange code c masters
9th Sep 2018, 12:17 PM
Sweet heart
Sweet heart - avatar
+ 3
beginners
9th Sep 2018, 12:17 PM
Sweet heart
Sweet heart - avatar
+ 3
what i want to do now...
9th Sep 2018, 12:22 PM
Sowmiya
Sowmiya - avatar
+ 2
statements starting with # are preprocessor directives To include a header file we use #include<header.h> It won't work without #, it is a part of the statement
7th Sep 2018, 3:04 PM
michal
+ 2
See this https://www.sololearn.com/learn/1743/?ref=app You cannot use anything else instead of {}. The same way you cannot use anything else instead of #
7th Sep 2018, 4:31 PM
michal
+ 2
https://code.sololearn.com/c8krUt0Rk897/?ref=app write in c challange to sowmiya
9th Sep 2018, 12:13 PM
Sweet heart
Sweet heart - avatar
+ 2
☺️
9th Sep 2018, 12:14 PM
Sweet heart
Sweet heart - avatar
+ 2
#include<stdio.h> int main() { int a=0,b=1,c,count,num=10; printf("The series is\n"); printf("%d \n%d\n",a,b); count=2; while(count<num) { c=a+b; a=b; b=c; printf("%d\n",c); count++; } return 0; }
9th Sep 2018, 12:42 PM
Sowmiya
Sowmiya - avatar
+ 2
is it ok..??
9th Sep 2018, 12:42 PM
Sowmiya
Sowmiya - avatar
+ 2
fine..ok.. yes sure...
9th Sep 2018, 4:35 PM
Sowmiya
Sowmiya - avatar
+ 1
preprocessor directives means what..?? if i want to know some thing ..i expect meaning for every thing..
7th Sep 2018, 3:08 PM
Sowmiya
Sowmiya - avatar
+ 1
why can't we use ??= insted of #.. ?? is it is possible..??
7th Sep 2018, 3:09 PM
Sowmiya
Sowmiya - avatar
+ 1
thank you for your brief and clear explaination....:)
8th Sep 2018, 5:25 AM
Sowmiya
Sowmiya - avatar
+ 1
yes...thank you...
8th Sep 2018, 8:58 AM
Sowmiya
Sowmiya - avatar
+ 1
yes...
9th Sep 2018, 12:18 PM
Sowmiya
Sowmiya - avatar