Skip to content

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

@derrell

Description

@derrell

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions