Which is valid C expression?Answer areaa) int my_num = 100,000;b) int my_num = 100000;c) int my num = 1000;d) int $my_num = 10000;
Question
Which is valid C expression?Answer areaa) int my_num = 100,000;b) int my_num = 100000;c) int my num = 1000;d) int $my_num = 10000;
Solution
The valid C expression among the given options is:
b) int my_num = 100000;
Explanation:
a) int my_num = 100,000; - This is not valid because in C language, we cannot use comma in a number.
b) int my_num = 100000; - This is a valid C expression. It declares an integer variable named my_num and initializes it with the value 100000.
c) int my num = 1000; - This is not valid because in C language, we cannot have spaces in a variable name.
d) int $my_num = 10000; - This is not valid because in C language, variable names cannot start with a dollar sign.
Similar Questions
What will the result of num variable after execution of the following statements? int num = 58; num % = 11; the given code is in c
Which of the following is an invalid statement?a b c = 1000 2000 3000a_b_c = 1,000,000a,b,c = 1000, 2000, 3000abc = 1,000,000
Understanding Ternary operator#include <stdio.h>int main() { int k, num = 100; k = (num > 50 ? (num <= 10 ? 100 : 200): 500); printf("%d %d\n", num, k); return 0;}What are the values a =
Variable declaration: specifies the name 'num' for an area of memory (variable) to contain a whole number(integer) between about -2 billion to +2 billion
What will be the output of following program?main( ){int k, num = 30 ;k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ;printf ( "\n%d", num ) ;}
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.