Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointers should not be assignable to ints, and vice versa #40

Open
derrell opened this issue Oct 30, 2014 · 0 comments
Open

Pointers should not be assignable to ints, and vice versa #40

derrell opened this issue Oct 30, 2014 · 0 comments

Comments

@derrell
Copy link
Owner

derrell commented Oct 30, 2014

Currently, this program generates no errors. It should, for pedagogical reasons, err on the two assignments, even though it's not technically illegal in C.

#include <stdio.h>

int main(int argc, char * argv[])
{
    char *  p = "hello";
    int     i;

    i = p;
    p = i;
    printf("p=%s\n", p);
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant