Tag: c

56 votes
1 answers
2K views
How to contain escape sequences in macro definition #?

I am trying to use this macro definition in C: #define STR(x) #x Is it possible to contain some escape sequen

c
avatar
Kristopher
0 1 0 9
asked 07 September, 2021
67 votes
0 answers
1K views
When linked list element is created using calloc, how to delete element in the delete function without causing leaking issue?

My delete function can pass the test 1-5 shown in main() but can't pass test 6. The expected result is me

c
avatar
Roger
0 1 0 9
asked 07 September, 2021
57 votes
1 answers
2K views
fast multiplication of int8 arrays by constants

I wonder if there is a fast way of multiplying int8 arrays, i.e. for(i = 0; i < n; ++i) z[i] = x * y[i]

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
67 votes
2 answers
748 views
Syntax error in printf command in c programming

Just for context, I am a complete beginner at programming and learning C is my first experience at coding. I d

avatar
Basil
0 1 0 9
asked 07 September, 2021
56 votes
0 answers
330 views
popen & poll for output

We are using popen and poll with timeout for reading output from a process. I have a case where we with popen

avatar
Trudy
0 1 0 9
asked 07 September, 2021
55 votes
1 answers
2.5K views
Initializing the string in C; Is the following useful?

I know how to initialize strings in C in two different ways. char str[] = "abcd"; char str[] = {'a'

avatar
Freida
0 1 0 9
asked 07 September, 2021
54 votes
0 answers
1.2K views
How can I write accept function in my library in socket programming?

I am trying to write the code with my own library. I did this for the other functions such as 'bind'

avatar
Sena
0 1 0 9
asked 07 September, 2021
57 votes
1 answers
2.3K views
Using struct variables in functions - Conflicting types

i'm trying to pass struct variables to a function, but i receive: error: conflicting types for 'refe

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
51 votes
1 answers
508 views
GCC: what&apos;s the default value when a symbol is defined on command line?

The following test code shows that a -DMY_FLAG on command line gives the symbol MY_FLAG a non-zero value, acco

avatar
Shanita
0 1 0 9
asked 07 September, 2021
60 votes
0 answers
1.9K views
SCANF probably not reading the correct value

If you enter more than five characters in the "name" field the function giving wrong output,otherwise if the

avatar
Nereida
0 1 0 9
asked 07 September, 2021
58 votes
9 answers
1.3K views
How to overlay one div over another div

I need assistance with overlaying one individual div over another individual div. My code looks like this: &

avatar
Dusty
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
418 views
Can I hide the HTML5 number input’s spin box?

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) rende

avatar
Tana
0 1 0 9
asked 07 September, 2021
50 votes
20 answers
1.1K views
CSS selector for first element with class

I have a bunch of elements with a class name red, but I can't seem to select the first element with the c

avatar
Janella
0 1 0 9
asked 07 September, 2021
59 votes
25 answers
460 views
How to write a:hover in inline CSS?

I have a case where I must write inline CSS code, and I want to apply a hover style on an anchor. How can I u

avatar
Elicia
0 1 0 9
asked 07 September, 2021
49 votes
30 answers
1.7K views
How do I remove the space between inline/inline-block elements?

Given this HTML and CSS: span { display:inline-block; width:100px; background-color:palevi

avatar
Vi
0 1 0 9
asked 07 September, 2021
53 votes
22 answers
942 views
What is the best way to conditionally apply a class?

Lets say you have an array that is rendered in a ul with an li for each element and a property on the controll

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
1.4K views
Center a column using Twitter Bootstrap 3

How do I center a div of one column size within the container (12 columns) in Twitter Bootstrap 3? .cente

avatar
Hilario
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
615 views
Maintain the aspect ratio of a div with CSS

I want to create a div that can change its width/height as the window's width changes. Are there any CSS

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.1K views
How to make Twitter Bootstrap menu dropdown on hover rather than click

I'd like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
1.9K views
How can I center an absolutely positioned element in a div?

I need to place a div (with position:absolute;) element in the center of my window. But I am having problems d

avatar
Virgil
0 1 0 9
asked 07 September, 2021