473,379 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

what is the output of this program

Expand|Select|Wrap|Line Numbers
  1. Q1.What will be output of the following c program?
  2. #include<stdio.h>
  3. static num=5;
  4. int num;
  5. extern int num;
  6. int main(){
  7. printf("%d",num);
  8. return 0;
  9. }
Jan 25 '14 #1
3 1391
weaknessforcats
9,208 Expert Mod 8TB
Have you compiled it to see what it does?
Jan 25 '14 #2
i compiled....its coming 55...
Jan 26 '14 #3
I got output as 5 after solving




"The static storage class is used to declare an identifier that is a local variable either to a function or a file and that exists and retains its value after control passes from where it was declared. This storage class has a duration that is permanent. A variable declared of this class retains its value from one call of the function to the next. The scope is local. A variable is known only by the function it is declared within or if declared globally in a file, it is known or seen only by the functions within that file. This storage class guarantees that declaration of the variable also initializes the variable to zero or all bits off.






The extern storage class is used to declare a global variable that will be known to the functions in a file and capable of being known to all functions in a program. This storage class has a duration that is permanent. Any variable of this class retains its value until changed by another assignment. The scope is global. A variable can be known or seen by all functions within a program. ."
Jan 26 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rafal Lagowski | last post by:
Hi all This is my small problem ... I have a program which make a long long statistic (about 2 minutes) It enough to timeout in my browser (or squid proxy of client) I want first make a...
8
by: brian.digipimp | last post by:
I turned this in for my programming fundamentals class for our second exam. I am a c++ newb, this is my first class I've taken. I got a good grade on this project I'm just wondering if there is a...
10
by: free2cric | last post by:
Hi, FOllowing is a program which is written by someone else. Its output is a wonderful poem. I dont understand how it works really. can anyone tell. thanks cric #include <stdio.h> main(int...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
11
by: howa | last post by:
#include<iostream> using namespace std; int main(int argc, char* argv) { cout<<sizeof(argv) / sizeof(argv) ; return 0; };
11
by: compsci | last post by:
Write a program that uses functions to calculate a person’s paycheck. The program should ask for a person’s first and last name, social security number (use fakes), phone number, address, hours...
7
by: new4cprog | last post by:
#include<stdio.h> void what (char *str) { if (*str) { what (str+6); putchar (*str-1); } return; void main() { char *str = “\”YeN! cEnT! pEsO! pEnCe! LeMpIrA! pUls! Ha!!\””;
12
by: broli | last post by:
#include<stdio.h> #include<stdlib.h> struct point { double x, y, z;
2
by: fury30 | last post by:
this is the program as below and now what i need to do is add the following to it but i am not able to get how to do it # futval.py # A program to compute the value of an investment # ...
1
rampraveen
by: rampraveen | last post by:
****************************************************** program for sharing memory ****************************************************** #include"stdio.h" #include"conio.h" #include"file12.c"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.