samedi 29 septembre 2018

Storing ASCII characters in an array in C

I am trying to make a random generator using ASCII characters and due to my minimal knowledge, I am having difficulty trying to identify the best way to go about making this random generator.

Currently, I have managed to make a simple array which currently holds 6 values.

#include <stdio.h>
#include <conio.h>

    int main()
{
    int i;

    int  array[255] = {1, 2, 3 , 4, 5, 6 };

    for(i = 0; i < 6; i++)
    {
        printf("%d", array[i]); /* Prints out all values declared in the array*/
    }

    return 0;
}

output: 123456

What I am currently stuck on now is trying to find out how to replace the numbers with ASCII characters. If anyone could help me figure this out, I would be very grateful.




Aucun commentaire:

Enregistrer un commentaire