Why does C not have run time errors?

Atreyo Bhattacharjee

Commendable
Feb 7, 2017
42
0
1,580
0
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?
 
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.
 
Thread starter Similar threads Forum Replies Date
reble Apps General Discussion 2
I Apps General Discussion 5
B Apps General Discussion 1
R Apps General Discussion 1
A Apps General Discussion 0
K Apps General Discussion 0
C Apps General Discussion 1
J Apps General Discussion 4
J Apps General Discussion 1
S Apps General Discussion 6
F Apps General Discussion 1
D Apps General Discussion 0
warhammer3025 Apps General Discussion 1
K Apps General Discussion 3
I Apps General Discussion 5
K Apps General Discussion 4
J Apps General Discussion 1
meloonharrier1199 Apps General Discussion 24
2 Apps General Discussion 1
J Apps General Discussion 5

Similar threads


ASK THE COMMUNITY