c - Finding issues in a code snippet -


i need screening question (in c) asked company.

the question find out issues below code.

short test() {    short a,b,c;    b=10;    c = + b;    return c;  } 

also, if signature changed short test(short a) , removed stack?

i cannot seem find issues code except junk values stored in 'a' not initialized. , second question, difference make if 'a' passed argument function? can please me this?

the value of a indeterminate because uninitialized. reading a results in undefined behavior. if a passed function , uninitialized same problem occur, sooner.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -