Solution not clear

pls explain how is there no error in line 4? as there is no defined data type like int double etc. similar to line 6

Hi… which ques are u referring to?? pls share snippet of the same…

i cant share the snippet… its q3

"/* The output of the following program is ? */ 1) #include 2) using namespace std; 3) int main(){ 4) signed CodingBlocks = 9; 5) signed Nagarro = A; 6) signed char HackerBlocks = ‘A’; 7) cout<<CodingBlocks<<endl; 8) cout<<HackerBlocks<<endl; 9) return 0; } "

hi… pls take screenshot and share pic…

  • By default, integers are signed . Hence instead of signed int , we can directly use int .
  • signed and unsigned can only be used with int and char types.
    so its correct…

but in line 4, it is written “signed CodingBlocks = 9” and int or char is not mentioned in this line then how will the compiler know it is int?

basically if we assign any character value to signed and the print the same the we get ascii value of that character as the output…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.