Questions tagged [c99]

This tag is for questions regarding the International Standard ISO 9899:1999, aka "C99", with technical corrigenda, and for questions about code written in C99 (as opposed to K&R C, C89 or later C Standard revisions like the 2011 revision C11).

This tag is for questions regarding the International Standard ISO 9899:1999 , aka "C99", with technical corrigenda, and for questions about code written in C99 (as opposed to K&R C, C89 or later C Standard revisions like the 2011 revision C11).

Always use the tag for all your C questions, then complement it with the tags for questions that are specific to this version of the standard.

1900 questions
0
votes
1 answer

realloc() invalid old size on struct arrays

I have been assigned to make a functioning student election program for our school defense (and probably for actual use ... ). However I've been stuck with a problem for a while now. My goal is to make a flexible array of structs, since I can't use…
0
votes
3 answers

How to I manage code for different Pin-Out boards in an embedded platform for better HAL management?

The issue here is, if you project is small, #if defined, #define, #elif defined chains get long, tedious, and prone to failure. There’s got to be a better way to accomplish this at compile. Currently I’m running my code through the #if / #elif…
jemo
  • 1
  • 2
0
votes
3 answers

Assigning and accessing pointer to string within struct

I'm trying to store a string in an array contained within a struct, and access it, but I'm having a hard time. The struct looks like this: typedef struct { void **storage; int numStorage; } Box; Box is initialized as such: b->numStorage…
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
4 answers

Accessing arrays in a pointer to a struct

I have a simple struct: typedef struct { void *things; int sizeOfThings; } Demo; things is intended to contain an array of individual "thing", like maybe strings or ints. I create a pointer to it: Demo * Create(int value) { Demo *d =…
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
0 answers

Create a Playing Board

Board dimensions are taken in and if the user enters: row = 4 columns = 3 I have written the code but I can only get the board to display: ... ... ... ... Board* createBoard(int rows, int cols) { Board *board = malloc(sizeof(Board)); …
Kanishka Kapoor
  • 11
  • 1
  • 1
  • 4
0
votes
1 answer

Process returned -1073741571 (0xC00000FD) execution time : 3.675 s

have any body another way to do this. I should write a recursive function that finds and returns the length of a connected curve by counting the 'X' letters. The curve is uniquely determined by any starting point (m, n) that is on a curve…
Mo.x
  • 11
  • 2
0
votes
3 answers

Why is CodeBlocks highlighting the keyword class and compiling it without any error (I am programming in C)?

I was trying to create a class in c, after seeing some tutorial. I saw video on classes and objects on youtube , the code was in java but instructor said it is same for other languages too. I have learnt some basic in C language. When I opened…
0
votes
2 answers

Function overloading inside a C99 struct

Normally, in C99, you can achieve function overloading (number of arguments, not type overloading) by using VA_ARGS and some kind of macro trick like: #define THIRD_PARAMETER(_1,_2,_3,...) _3 #define NOTHING for example: void pr1(int x); void…
Duy
  • 45
  • 1
  • 4
0
votes
2 answers

Recursive implementation of stack without arrays POP not working

I'm trying to implement a LIFO stack recursively without using arrays. The program takes in strings and ints as input, and has a few commands -- namely push pop empty top and quit. Everything but pop works fine for me, and pop only works…
bone bot
  • 1
  • 2
0
votes
3 answers

Any way to to include original parameters in fscanf in C

I'm trying to see if when I do fscanf(inputSTREAM, "$%s$", out) I can also return the $ signs - is there a way?
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
2 answers

Nongreedy fscanf and buffer overflow check in c

I'm looking to have fscanf identify when a potential overflow happens, and I can't wrap my head around how best to do it. For example, for a file containing the string **a**bb**cccc** I do a char str[10]; while (fscanf(inputf, "*%10[^*]*", str) !=…
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
2 answers

Handling pointers within multiple functions in C

I'm trying to create functions out of existing code in order to make it cleaner, and I'm having some problems: It used to be: int foo(char * s, char * t, char ** out) { int val = strcmp(s, t); if (val == 0) { *out = strdup(s); return…
Rio
  • 14,182
  • 21
  • 67
  • 107
0
votes
1 answer

Sorting algorithm for arbitrary number of words (alphabetical order) with use of struct as a "database"

So I'm supposed to do the sorting algorithm as a CS homework. It should read arbitrary number of words each ending with '\n'. After it reads the '.', it should print the words in alphabetical order. E.g.:…
DemoVision
  • 71
  • 6
0
votes
1 answer

Add 2 big numbers from left to right

Is it possible to add 2 big numbers without reversing the array? I must use this declaration of function: int add(const char* n1, const char* n2, char** sum); I cannot reverse arrays because it's cosnt char* :(
logic
  • 1
  • 1
0
votes
0 answers

How to combine c11 and c99 compilers

I have a SPARC server with Solaris SPARC 10 OS installed I am trying to compile source code from VLC media player and PHP 7 tarballs However the stumbling block I encounter is that when I type in ./configure into my PUTTY terminal the gcc compiler…
1 2 3
99
100