Function visible even if not included in C

I have defined function A in main.c file. I have created three libraries which use the function A without importing anything. The code works but I have only one warning: implicit declaration of function 'A' [-Wimplicit-function-declaration]. How is ...
more »

2017-06-16 11:06 (3) Answers

how to read integer int* from text in c

I have this structure and a structure for AVL tree struct imobil { unsigned int id; char *streetName; unsigned int streetNumber; int noApartaments; int *noPeopleLivingInApartaments; float totalValue; }; struct nodeAVL { ...
more »

2017-06-15 23:06 (1) Answers

Initialize C struct through a function

So I do have to write a vector-like data structure in C. Generally I made a structure like this: struct Vector { int length; int *elements; }; And functions like these: void initialize_vector(struct Vector* vector); void create_vector(str...
more »

2017-06-15 20:06 (2) Answers

Compare between pointers and integer

I have a question, I tried to copy one line from a pointer to file but there is one error that says that I cannot compare a interger with a pointer, can anyone help me? The error is in line ch = getc(file1); and while(ch != EOF) #include <stdio.h...
more »

2017-06-14 22:06 (1) Answers

Why can't I print the value at this pointer?

Following yesterday's question, I experimented some more with pointers. Specifically pointers of type int (*) [n] Here's some code I wrote : #include <stdio.h> int main(void) { int a[5] = {1, 2, 3, 4, 5}; int (*p) [5] = &a; ...
more »

2017-06-14 09:06 (3) Answers

Call by value in C

I'm new to programming and I am currently working on C. I learned that C does not have call by reference. The programs that we write to pass the address of actual parameters to the formal parameters is also call by Value in C. Correct me if I'm wro...
more »

2017-06-14 07:06 (5) Answers

Referencing a char* that went out of scope

I recently started programming in C again after having programmed in C++ for a while, and my understanding of pointers is a bit rusty. I would like to ask why this code is not causing any errors: char* a = NULL; { char* b = "stackoverflow"; ...
more »

2017-06-13 21:06 (3) Answers

Printing Columns in C

There are similar questions asked, but none that help me arrive at the answer I'm looking for, so I've come to ask for help! Also, this is homework so I am looking for an explanation more so than just working code. I need to print two, or maybe its...
more »

2017-06-13 13:06 (4) Answers

How to do an explicit fall-through in C

The newer versions of gcc offer the Wimplicit-fallthrough, which is great to have for most switch statements. However, I have one switch statement where I want to allow fall throughs from all case-statements. Is there a way to do an explicit fall th...
more »

2017-06-13 04:06 (2) Answers

Poor man's alternative to _mm_cvttpd_epi64

On AXV512DQ, there is _mm_cvttpd_epi64, for example in file avx512vldqintrin.h we find static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvttpd_epi64 (__m128d __A) { return (__m128i) __builtin_ia32_cvttpd2qq128_mask ((__v2df) __A, (_...
more »

2017-06-12 19:06 (0) Answers

strptime handling space in fixed format string

Is there a way to get strptime() to handle fixed format time strings? I need to parse a time string that is always on the fixed width format: "yymmdd HHMMSS", but with the complication that leading zeros are sometimes present and sometimes not. Re...
more »

2017-06-12 16:06 (1) Answers