# Search:

Type: Posts; User: flp1969

Page 1 of 20 1

1. ## Thread: Scanf value trouble

by flp1969
Replies
1
Views
84

### From scanf() manpage: RETURN VALUE On...

From scanf() manpage:

RETURN VALUE
On success, these functions return the number of input items successfully matched and assigned; this can be fewer than provided for, or even zero, in...
2. ## Thread: Regarding Programming Practice

by flp1969
Replies
4
Views
109

### Search your feelings... I know there is still...

Search your feelings... I know there is still good in you...
3. ## Thread: Dynamically allocated 2D array of chars - unkwnown number of rows and columns

by flp1969
Replies
3
Views
113

### If you are curious on how to allocate a...

If you are curious on how to allocate a bidimensional array, here's a tip:

#include <stdio.h>
#include <stdlib.h>

int main( void )
{
int i, j;
int ( *ptr )[][20]; // ptr = pointer to...
4. ## Thread: digits of precision in floats

by flp1969
Replies
3
Views
86

### Another word of caution: It is said floats has 6...

Another word of caution: It is said floats has 6 decimal digits (not "fractional digits", but "overall digits") of precision, it doen't mean all decimal fracional values can be store exactly in...
5. ## Thread: digits of precision in floats

by flp1969
Replies
3
Views
86

### Another thing... when you use literals as...

Another thing... when you use literals as 3.12345678901234567890 or functions as atan(), you are dealing with double precision (double).

Literal constants to single precision have 'f' suffix (like...
6. ## Thread: digits of precision in floats

by flp1969
Replies
3
Views
86

### The "precision" of floating point types is given...

The "precision" of floating point types is given by the number of significant bits, not the decimal fractional part of the number.
When it is said 'single precision' has 6 or 7 digits of precision,...
7. ## Thread: Output parameter practices

by flp1969
Replies
6
Views
135

### Well... I try to use the "left hand side" rule...

Well... I try to use the "left hand side" rule used in some C standard functions... As examples:

// dest is the 'output'
char *strcpy( char *dest, char *src );

// 'buffer' is the 'output'...

by flp1969
Replies
6
Views
118

### Ok... your ONLY question: "What am I missing...

Ok... your ONLY question: "What am I missing here?"
A: I think you aren't missing anything...

by flp1969
Replies
6
Views
118

### Aren't you overthinking about pointers usage? ...

Aren't you overthinking about pointers usage?

// FIX: Returns true if OK, false if allocation fail.
int push ( Node **head, int new_data )
{
Node *new_node = malloc ( sizeof ( Node ) );

...
10. ## Thread: 8 bit bit wise operation

by flp1969
Replies
2
Views
128

### // Assuming string is less then 33 chars long...

// Assuming string is less then 33 chars long (excluding the '\0').
// Assuming, also, each char is either '0' or '1'.
unsigned int bin2int(char *str)
{
unsigned int n = 0;

while ( *str )...
11. ## Thread: Most widely used C language standard

by flp1969
Replies
2
Views
124

### I believe C99 is the most popular nowadays, but...

I believe C99 is the most popular nowadays, but compilers like GCC [version 7 or superior, I think] uses extended C11 by default (GNUC11).
12. ## Thread: Fill in the blank code - generic Bubble sort - C

by flp1969
Replies
21
Views
277

### This doen't seem to be bubble sort, but insertion...

This doen't seem to be bubble sort, but insertion sort...
Insertion Sort
Bubble Sort

by flp1969
Replies
1
Views
88

### Change line 20 to: printf( "%f\n", sr );...

Change line 20 to:

printf( "%f\n", sr );
And line 38 to:

return (double)wynik / n;
14. ## Thread: bitwise char array shift

by flp1969
Replies
9
Views
204

### Seeing your code I assume you speak portuguese,...

Seeing your code I assume you speak portuguese, right? I am brazillian and here's one article I wrote sometime ago:

Deslocando uma string de bits.

by flp1969
Replies
2
Views
144

Assembly?

by flp1969
Replies
9
Views
240

Exactly! :)
17. ## Thread: Need help with a bouncing ball.

by flp1969
Replies
9
Views
240

### From IOCCC: /* ball.c */ /* Compile with:...

From IOCCC:

/* ball.c */
/* Compile with: 'gcc -ansi -o ball ball.c -lm' */
/* Works on linux */
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <sys/ioctl.h>
18. ## Thread: Average value of recursive function

by flp1969
Replies
3
Views
127

### Nope... this function returns 'n*alg', the...

Nope... this function returns 'n*alg', the average is 'alg'.

And... if n <= 0 (n is a signed integer!) it will return 'alg*((2łą - abs(n)) + 2łą-2)'.
19. ## Thread: "Unescaping" certain characters from binary file

by flp1969
Replies
7
Views
195

### Is 'byte' a pointer? 'byte+1' isn't a lvalue and...

Is 'byte' a pointer? 'byte+1' isn't a lvalue and will cause a compilation error... and you are using 'tmp' instead of 'temp', did you notice?
What this code is supposed to do?
20. ## Thread: volatile variable c program

by flp1969
Replies
4
Views
146

### One example of what @Hodor probably meant by "By...

One example of what @Hodor probably meant by "By using the volatile keyword you're telling the compiler to be very careful about assumptions it might otherwise make":

int a;
volatile int b;
...
21. ## Thread: read data every hour and find average value in C

by flp1969
Replies
2
Views
127

### Well... Using 'int' to hold the number of seconds...

Well... Using 'int' to hold the number of seconds is not that bad. Timestamps, for example, can hold the number of seconds since January 1st 1970 to 2038 using a 32 bits integer (time_t is...

by flp1969
Replies
17
Views
364

### Nooo... really?! ;)

Nooo... really?! ;)

by flp1969
Replies
17
Views
364

### Hehhee: log xy = log x + log y log x/y = log...

Hehhee:

log xy = log x + log y
log x/y = log x - log y
log x^y = y * log x

Simple as this... :)
24. ## Thread: Average word length

by flp1969
Replies
7
Views
179

### Another one for your study: /* Compile with...

/* Compile with GCC:

gcc -o test test.c

Add -DDEBUG with you want to see 'debug' messages. */
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
25. ## Thread: what happen during the execution of code

by flp1969
Replies
2
Views
168

### Depends on the compiler optimization. Could be on...

Depends on the compiler optimization. Could be on registers.
Results 1 to 25 of 500
Page 1 of 20 1