Chcę w funkcji fun(int ***ptr); przypisać do ptr adres na wskaźniki do tablic typu int. Jak zaalokować na to pamięć i przypisać jakąś przykładową liczbę?
#programowanie #c99
#programowanie #c99
Wszystko
Wszystkie
Archiwum
#include
#include
#include
int main(int argc, char* argv[])
{
const char * file_name = "file.txt";
char line[256];
int d1,d2,d3;
char *ptr;
int i;
FILE* file = fopen(file_name, "r");
if(!file){
perror("fopen error");
exit(EXIT_FAILURE);
}
while ( fgets(line, sizeof(line), file) ) {
ptr = line;
while(ptr != NULL){
sscanf(ptr, "%d %d %d", &d1, &d2, &d3);
printf("got numbers: %d
union bits {
uint32_t raw;
struct {
unsigned char b1 : 1;
unsigned char b2 : 1;
...
unsigned char b32 : 1;
};
};
If enough space remains, a bit-field that immediately follows another bit-field in a structure shall be packed into adjacent bits of the same unit.
There may be unnamed padding within a structure object, but not at its beginning
MyClass
źródło: comment_RsC2nFUsJGGJ1xy6lBudEwFYE4pSI1eJ.jpg
PobierzWykop.pl
Jak w niej pobrac teraz n-ty element tablicy której pojedynczy element ma s-size?
#programowanie #c #c99