Computer Science, asked by vaibhavichanne2819, 9 months ago

[A] Which of the following are invalid C constants and why?
'3.15
35,550 3.25e2
2e-3
'eLearning' "show"
'Quest'
4652

[B] Which of the following are invalid variable names and why?
int
B'day
#HASH
totalArea
total%
variable name
dot.
_main()
1st
%name%
Shello
number
temp_in_Deg
stack-queue
salary​

Answers

Answered by raoaisha230
5

Answer:

Which of the following are invalid C constants and why?

'3.15

35,550 3.25e2

2e-3

'eLearning' "show"

'Quest'

4652

Answered by RitaNarine
2

A.

  • '3.15
  • 35,550 3.25e2
  • 2e-3
  • 'eLearning' "show"  these are invalid C constants
  • 'Quest'
  •  4652   these are valid Constants  

How to check whether it is a valid constant or invalid?

  • An integer constant consists of a sequence of Integer numbers from 0 to 9
  • Decimal points, black spaces, and commas cannot be included within an integer constant.
  • An Integer constant can either be positive or negative or zero.
  • The number without a sign can be assumed a positive

B.

  • int                  
  • B'day  
  • #HASH
  • stack-queue
  • %name%
  • total%
  • variable name
  • dot.
  • _main()

these are invalid variables, remaining are valid variables because ypu can check the below points;

How to check whether it is a valid Variable or invalid?

  • A variable cannot start with a number or numeric value like 1,2,3 etc.
  • No special characters can be used other than underscore(_). For eg:- ×*%#@ ., are prohibited in variable names.
  • A variable can only start with an underscore or an alphabet(uppercase and lowercase both are both included).
  • #SPJ2

Similar questions