in one file global variable int i; is declared as static. In
another file it is extern int i=100;
Is this valid ?
Answers were Sorted based on User's Feedback
Answer / dipti
No its in valid as a static variable cannot be declared as extern.
The whole and entire purpose of static is to declare that a variable is private to the source file that it is declared in.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can a program be made to print the name of a source file where an error occurs?
What are global variables and explain how do you declare them?
What the advantages of using Unions?
2. Write a function called hms_to_secs() that takes three int values—for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds.. Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns.
Can a pointer be static?
Tell me can the size of an array be declared at runtime?
What is the meaning of typedef struct in c?
HOW TO SWAP TWO NOS IN ONE STEP?
How can I recover the file name given an open stream?
Differentiate between the expression “++a” and “a++”?
Can we assign string to char pointer?
. Write a program to get a string and to convert the 1st letter of it to uppercase