jeudi 25 novembre 2021

warning: assignment makes pointer from integer without a cast [-Wint-conversion] p = (i + 1) * 100;

i am trying to fill array with the numbers without using scanf. I encountered warning: assignment makes pointer from integer without a cast [-Wint-conversion] p = (i + 1) * 100; ^ and when i try to print the array the array output random values. How do i solve it?

#include<stdio.h>

int main() {
    int nums[8], i;
    int *p;
    p = nums;
    for (int i = 0; i < 8; ++i)
    {
        p = (i + 1) * 100;
        p++;
    }

    return 0;
}



Aucun commentaire:

Enregistrer un commentaire