Preprocessor Directives



 Describing  #pragma directive in detail:-

Pragma is implementation specific directive i.e each pragma directive has different implementation rule and use . There are many type of pragma directive and varies from one compiler to another compiler .If compiler does not recognize particular pragma the it ignore the pragma statement without showing any error or warning message and execute the whole program assuming this pragma statement is not present,
e.g
suppose any arbitrary pragma directive is #pragma world :


#pragma world
void main()
{
printf(“C is powerful language “);
}
Output : C is powerful language
Explanation:

Since #pragma world is unknown for Turbo c compiler so it ignore this directive without showing error or warning message and execute the whole program assuming #pragma world statement is not present.
List of pragma directive :
1. #pragma startup
2. #pragma exit
3. #pragma warn
4. #pragma option
5. #pragma inline
6. #pragma argsused
7. #pragma hdrfile
8. #pragma hdrstop
9. #pragma saveregs
 
Explain the #pragma inline ?
Ans:
#pragma inline only tells the compiler that source code of program contain inline assembly language code .In in C we can write assembly language program with help of asm keyword.  
 
 
Describe #pragma warn directive ?
Ans:
In c there are many warning messages which can be on or off with help of #pragma warn.
Syntax :
#pragma warn +xxx
#pragma warn –xxx
#pragma warn .xxx
Where
+ means on
- means off
. means on/off (toggle)
xxx is indicate particular warning code in thee alphabet
e.g
rvl is warning code which means function should return a value.

#pragma warn –rvl
Int main()
{
Printf(“It will not show any warning message”);
}
Output: It will not show any warning message
When you will execute the above program then compiler will not show the warning message function should return a value because rvl warning has offed.
 
What is #pragma startup and #pragma exit ?
Ans:
Syntax:
#pragma startup [priority]
#pragma exit [priority]
Where priority is optional integeral number.
For user priority varies from 64 to 255
For c libraries priority varies from 0 to 63
Default priority is 100.
pragma startup always execute the function before the main function
pragma exit always execute the function after the main function.
Function declaration of must be before startup and exit pragma directives and function must not take any argument and return void i.e
void (void)
If more than one startup directive then priority decides which will execute first.
For startup :
Lower value : higher priority i.e function will execute first.
If more than one exit directive then priority decides which will execute first
For exit:
Higher value: higher priority i.e function will execute first.
For example

void india();
void usa() ;
#pragma startup india 105
#pragma startup usa
#pragma exit usa
#pragma exit india 105
void main()
{
printf("\nI am in main");
getch();
}
void india()
{

printf("\nI am in india");
getch();
}
void usa()
{

printf("\nI am in usa");
getch();
}
Output:
I am in usa
I am in India
I am in main
I am in India
I am in usa
Explanation:
Above program there are two startup directive which will execute before the main function.
Function name India has priority 105
Function name usa has priority 100 (default)
So usa function will execute first than India function and above program there are two exit directive which will execute after the main function.
Function name India has priority 105
Function name usa has priority 100 (default)
So india function will execute first than usa function. 
 
What is #error directives ?
Ans:
Syntax : #error
If compiler compiles this line then it shows a compiler fatal error i.e it only issue an error message and this error message includes . i.e it only issue an error message and this error message includes .
e.g :

#ifndef __MATH_H
#error First include then compile
#else
void main()
{
float a,b=25;
a=sqrt(b);
printf(“%f”,a);
}
#endif
Output: compiler error --> Error directive :First include then compile


What is use of #line directive?
Ans:
It tells the compiler that next line of source code is at the line number which has been specified by constant in #line directive i.e it transfer the program control to the line number which has been specified by #line directive.
e.g
#line 15
void main()
{
int a=10;
a++;
clrscr();
a++;
#line 5
printf(“%d”,a);
getch();
}

If we will see its intermediate file then before the actual compilation the source code is expanded as :

41 comments:

  1. Covers Embedded system related topics Microcontroller annd its peripherals, Basic linux and windows commands, UART,I2C,SPI, CAN etc protocols. GSM, GPRS and 3G mobile communication system. Basic differences. Operating system basic fundamentals. Dot Net Training | Dot Net Training in velachery

    ReplyDelete
  2. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Digital Marketing online training

    full stack developer training in pune

    full stack developer training in annanagar

    full stack developer training in tambaram


    ReplyDelete
  3. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Digital Marketing online training

    full stack developer training in pune

    full stack developer training in annanagar

    full stack developer training in tambaram


    ReplyDelete
  4. I am really very happy to find this particular site. I just wanted to say thank you for this huge read!! I absolutely enjoying every petite bit of it and I have you bookmarked to test out new substance you post.
    python training institute in chennai
    python training in Bangalore
    python training in pune
    python training institute in chennai
    python training in velachery
    python online training

    ReplyDelete
  5. Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. It was definitely interesting for me to read  about their market situation nowadays.

    Blueprism training in btm

    Blueprism online training

    ReplyDelete
  6. Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays.
    AWS Certification Training

    ReplyDelete
  7. Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
    Sap Pp Training From India

    ReplyDelete
  8. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.
    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete
  9. employees at a time so you can monitor the sheer number of working hours of each employee. It helps you in calculating the precise soon add up to be paid to a member of staff depending until the number of hours QuickBooks Payroll Support Phone Number has contributed of their work. The amazing feature because of this application is direct deposit and that can be done at any time one day.

    ReplyDelete
  10. at any point of the time as most of us is oftentimes prepared to work with you. A lot of us is responsible QuickBooks Support Number sure to deliver hundred percent assistance by working 24*7.

    ReplyDelete
  11. How to contact QuickBooks Payroll support?
    Different styles of queries or QuickBooks related issue, then you're way in the right direction. You simply give single ring at our toll-free intuit QuickBooks Payroll Help Phone Number USA . we are going to help you right solution according to your issue. We work on the internet and can get rid of the technical problems via remote access not only is it soon seeing that problem occurs we shall fix the same.

    ReplyDelete
  12. Our support also also incorporates handling those errors that always occur when your form of QuickBooks has been infected by a malicious program like a virus or a spyware, which may have deleted system files, or damaged registry entries. Moreover, our QuickBooks Enterprise Support Phone Number also handle just about any technical & functional issue faced during installation of drivers for QB Enterprise; troubleshoot any type of glitch that will arise in this version or even the multi-user one.

    ReplyDelete
  13. Stay calm when you get any trouble using payroll. You simply need to make one call to resolve your trouble with the aid of the Intuit Certified Pro Advisor. Dial QuickBooks Payroll Tech Support Phone Number for effective solutions for basic, enhanced and intuit full service payroll. Whether the issue is related to the tax table update, service server, payroll processing timing, Intuit server struggling to respond, or QuickBooks update issues; we assure one to deliver precise technical assist with you on time.

    ReplyDelete
  14. QuickBooks Payroll Technical Support as well provides all possible help with the users to utilize it optimally. An individual who keeps connection with experts has the capacity to realize in regards to the latest updates.

    ReplyDelete
  15. QuickBooks Technical Support Phone Number is the greatest platform for smaller businesses. QuickBooks technical support number allows you to run all QuickBooks Payroll services boosting your company quickly.

    ReplyDelete

  16. You are able to choose for any QuickBooks versions looking on the desires. QuickBooks are often generally split into 2 categories: QuickBooks 247 Support Phone Number version and QuickBooks Desktop version.

    ReplyDelete
  17. Quickbooks Support Telephone Number
    QuickBooks has completely transformed the way people used to operate their business earlier. To get familiar with it, you should welcome this positive change.Supervisors at QuickBooks Support Phone Number have trained all of their executives to combat the issues in this software. Utilizing the introduction of modern tools and approaches to QuickBooks, you can test new techniques to carry out various business activities. Basically, this has automated several tasks that have been being done manually for a long time. There are lots of versions of QuickBooks and each one has a unique features.

    ReplyDelete
  18. QuickBooks Support contact number has too much to offer to its customers to be able to manage every trouble that obstructs your projects. You will find loads many errors in QuickBooks Tech Support Number such as difficulty in installing this software, problem in upgrading the software in the newer version so that you can avail the most up-to-date QuickBooks features, trouble in generating advanced reports, difficulty with opening company file in multi-user mode and so on and so forth. Whatever the issue is, if it bothers you and deters the performance within your business, you may have to not get back seat and gives up, just dial us at our toll-free number and luxuriate in incredible customer support.

    ReplyDelete
  19. Not really Small And Medium Company But Individuals Too Avail The Services Of QuickBooks Enterprise Support Phone Number. It Is Developed By Intuit Incorporation And Contains Been Developing Its Standards Ever Since Then.

    ReplyDelete
  20. problem in upgrading the program in the newer version so that you could avail the newest QuickBooks features, trouble in generating advanced reports, difficulty with opening company file in multi-user mode and therefore on and so on. Whatever the issue is, if QuickBooks Support Phone Number bothers you and deters the performance of your respective business, you may need to not get back seat and supply up, just dial us at our toll-free number and luxuriate in incredible customer service.

    ReplyDelete
  21. You simply need certainly to build a straightforward charge less call on our QuickBooks Tech Support Number variety and rest leave on united states of america country. No doubt, here you will find the unmatchable services by our supportive technical workers.

    ReplyDelete
  22. If you’re encountering any type of QuickBooks’ related problem, you will definately get all of that problems solved simply by utilizing the QuickBooks Support Phone Number.

    ReplyDelete
  23. Utilizing the introduction of modern tools and approaches to Intuit QuickBooks Support Number, you can test new techniques to carry out various business activities. Basically, this has automated several tasks that have been being done manually for a long time. There are lots of versions of QuickBooks and each one has a unique features.

    ReplyDelete
  24. At QuickBooks Support Phone Number we work with the principle of consumer satisfaction and our effort is directed to give a transparent and customer delight experience. A timely resolution within the minimum span is the targets of QuickBooks Toll-Free Pro-Advisors. The diagnose and issue resolution process has been made step by step and is kept as simple as possible.

    ReplyDelete
  25. It must be flawless. Do you think you're confident about it? If you don't, this could be simply the right time so you can get the QuickBooks Customer Service Phone Number. We now have trained staff to soft your issue. Sometimes errors may possibly also happen as a consequence of some small mistakes. Those are decimals, comma, backspace, etc. Are you go through to deal with this? If you do not, we have been here that will help.

    ReplyDelete
  26. QuickBooks Support get back to us often times. We keep all the data safe plus in secrecy. We will never share it with other people. Thus, you can rely on us in terms of almost every data. we have a method of deleting the ability which you have put immediately from our storage. Thus, there's no possibility for data getting violated. You should arrive at us when it comes to a number of software issues. The satisfaction can be high class with us. It is possible to call us in several ways. You can journey to our website today. It is time to get the best help.

    ReplyDelete
  27. The user can surely get generate real-time basis advanced reports by using QuickBooks. If a person is certainly not known for this feature, then, it is possible to call our QuickBooks Technical Support Number. They will surely provide you with the necessary information to you.

    ReplyDelete
  28. And as we all know that QuickBooks Support Phone Number has many great features and QuickBooks scan manager is one of the amazing features of QuickBooks to simply maintain your all documents. However, if you are not using this amazing and most helpful QuickBooks accounting software, then you are definitely ignoring your business success.

    ReplyDelete
  29. QuickBooks Payroll Support Number application can access in desktop, Android and Mac and in addition can use online. You should not work hard just follow these several steps.

    ReplyDelete
  30. QuickBooks Enterprise is a high-functioning software designed specifically towards large organizations. It has multiple advanced features to help out accounting and bookkeeping professionals. It is still plagued with many bugs and errors. One such error is the QuickBooks Error 9999. If you would like to learn How To Troubleshoot Quickbooks Error 9999, you can continue reading this blog.

    ReplyDelete