top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why *0=0 crashes in C?

+1 vote
Why *0=0 crashes in C?
posted Jun 7, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
I think compilation itself will fail for *0=0

1 Answer

+1 vote
Best answer

The problem is with lvalue (left hand side of assignment). For each assignment there should be a valid address to store the value assigned through right side of the assignment operator. Here left side trying to access address 0 which is not allowed that's is the reason it is getting crashed.

answer Jun 8, 2017 by Ganesh Kumar
Similar Questions
0 votes

For given list of numbers find out triplets with sum 0 using C?
Input : arr[] = {0, -1, 2, -3, 1}
Output : 0 -1 1
2 -3 1

+1 vote

Array consist of -1 and 1, Find count of all sub-arrays where sum = 0.

[-1,1] [1,-1],[-1,1],[-1,1,-1,1]

+1 vote

What type of conversion is not accepted in C and why?
a) char to int
b) float to char pointer
c) int to char
d) double to char

+2 votes
struct marks {
  int a:1;
  int b:2;

int main() {
  struct marks obj={1,6};
  printf("%d %d\n",obj.b,obj.a);