Atreyo Bhattacharjee

Commendable
Feb 7, 2017
42
0
1,580
Disclaimer: I am a total noob in C, and don't have all too much experience in computer science in general (about 1 year).

I come from a background in Java and Python, and when I started learning C, I noticed something I found odd. Why does C not give run time errors, even if I intentionally add code, that should not function. For example, in CLion, I made a tiny program, where I made an int variable, and a char variable pointer. I was able to assign the char pointer to the int variable, and run the code without any errors. Why? Does C just not tell us something may be wrong, and does as its asked?
 
Solution
Because that "C", or as a friend of mine is calling it - "souped-up Assembly". With the power comes responsibility. On the top of that - in many C implementations, "char" and "int" types are the same, so assigning one to the other is totally "legal".

If you want strongly typed language - you already know some of them.
Because that "C", or as a friend of mine is calling it - "souped-up Assembly". With the power comes responsibility. On the top of that - in many C implementations, "char" and "int" types are the same, so assigning one to the other is totally "legal".

If you want strongly typed language - you already know some of them.
 
Solution