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
2 answers

Use of pointers in a division in C99, error: invalid operands to binary

The question surely look stupid, but I have always wasted a lot of time, with tests/errors until it works, with this kind of problem. I need a pointer to return a value from a function, then I need to divide this value, but I have the compiler…
Leon
  • 554
  • 4
  • 18
0
votes
1 answer

Macro with number of arguments AND default parameter

I'm familiar with the following way of creating a macro with variable number of arguments. However, consider: #define MY_MACRO_N(value, format, ...) my_func(value, format, ##__VA_ARGS__) #define MY_MACRO_0(value) my_func(value, NULL) Where my_func…
galah92
  • 3,621
  • 2
  • 29
  • 55
0
votes
0 answers

what's the difference between pointer==null and !pointer in my code?

in extended_map.c I wrote: #include "extended_map.h" #include "map.h" #include struct Extended_Map_t{ char* key; }; Extended_Map extended_mapCreate() { Extended_Map extended_map = malloc(sizeof(*extended_map)); if…
user13186558
0
votes
0 answers

how to remove code duplications in this code?

I am a new C99 programmer and want the help of the community on this one. I wrote the following function which receives two pointers for a node (Or simply Node) and a pointer to a pointer to node (Or *Node) an merges them together into one sorted…
user13293882
0
votes
1 answer

C error with using else macro "expected parameter declarator"

I wrote the following C code (according to the C99 standard) and it ran with no problems: #include #ifdef _WIN32 printf("Running on Windows"); #endif void test(int x); int main() { return 0; } but adding else caused so much errors…
user13186558
0
votes
1 answer

C are pointers erased after function call ends?

I have learned that whenever a function ends, every local variable declared inside of it is erased. That's why we must use malloc when declaring an array. But when I think about that again when a function ends what is really erased (in case I…
user13235423
0
votes
2 answers

C99 inline why can't we just keep using it?

I just learned that inline makes my code faster when working with functions, but I wonder why don't we just inline every single function, what's the point of writing functions in the normal way why we have such a powerful keyword (I know that the…
user12603566
0
votes
1 answer

Can I optimize memory usage of function that returns 12-byte struct?

I have code like this: // my struct size is 12 bytes typedef struct timer_entry_t { uint16_t t1_time_setting; uint16_t t2_time_setting; uint8_t time_range; uint8_t timer_mode; uint8_t relay_output_mask; uint8_t…
Kamil
  • 13,363
  • 24
  • 88
  • 183
0
votes
1 answer

fscanf does not retrieve any value

I have a file with Space Separated Values Eg: 6028 5 6 9813 2 10 10249 7 8 10478 8 8 10479 3 2 10516 6 3 10519 9 10 10525 3 7 10606 6 1 10611 6 9 10632 1 6 10638 9 4 And I can't retrieve them to…
Andrej Hatzi
  • 312
  • 4
  • 18
0
votes
1 answer

why can I assign array[i] for a static array of length i in c?

Let's assume I want to build myself a c like "string". Why does this code not throw an error when I assign array[6]? Does char array[6] not give me index 0-5? Has this something to do with stack vs heap? #include #include int…
Nivatius
  • 260
  • 1
  • 13
0
votes
1 answer

Check if there is a string in a string

I was wondering if there is any way to check if a string is included in a string. For example if I have the string1: superman and string2: per I would like to know that string2 is contained in string1 and that the first letter of string2 is in…
awwww
  • 23
  • 5
0
votes
0 answers

make a list of m nodes, where m is taken in input

Hi this is the code I wrote for create as many nodes as he needs (the m variable), but I noticed that using this method I'm creating one more node. What's the best way of fcreating as many nodes as the user say us? #include #include…
awwwww
0
votes
0 answers

Why doesn't remove the nodes of the list

Hi I have made a program that takes in input some integer and store them into a list. Once finished storing this datas in the list asks for a number x. Than I have to remove all the number that recurse >= than x this is how I have done it but it…
awwww
  • 23
  • 5
0
votes
1 answer

Sum recursively to each node all the nodes that come after it

Hi I need to do a recursive function that takes in input the head of a list and sum to each node all the nodes that come after that node. Example if the list is 1->2->3 the list will be modified in 6->5->3. I have done an iterative function that…
awwww
  • 23
  • 5
0
votes
1 answer

How to do a recursive function for linked node list

Hi I have to implement a recursive function taken in input the head of a list, sum to each node all the nodes that come after. (if the list is 1->2->3 it has to become 6->5->3) and then sum all the nodes together so for example the variablek become…
awwww
  • 23
  • 5