printf is a C function that prints formatted strings. Other languages have also added a printf function.
0
votes
1answer
16 views
Print using c++ variadic template
I made the task where i have to make print in C# style
tprintf("{} world{} {} {} {}\n","Hello",'!',123," Je", "end");
And the code is below
void tprintf(const char* format) // base function
{
...
0
votes
3answers
28 views
C Scanf suddenly stopped reading in values
I'm trying to run a simple C program on my Mac. It worked fine for a while but then suddenly scanf stopped working. I basically want to read in an integer value and output what was entered. No matter ...
-9
votes
3answers
56 views
using printf to output floats in c++ [closed]
I'm trying to output a float with
printf(theFloat);
However, this gives me the following error.
"argument of type "float" is incompatible with parameter of type
"const char *""
I'm not ...
1
vote
2answers
79 views
printf() prints whole array
Let's assume I have the following code in my C program:
#include <stdio.h>
void PrintSomeMessage( char *p );
int main(int argc, char *argv[]) {
char arr[10] = "hello";
...
2
votes
1answer
38 views
%ld format conversion for portability
I have a code base which is intended to compile without warnings and run without any glitches on multiple architectures, all x86: MSDOS, Windows 32 console mode, Windows 32 GUI mode, Linux 32, and ...
0
votes
1answer
55 views
C - what is wrong with my mergesort on linked list?
I got to the point where my program compiles (through vim, if that matters), but returns garbage. Here's the code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include ...
1
vote
2answers
45 views
Parameter evaluation sequence in printf [duplicate]
Recently I faced an issue understanding the behaviour for printf() function.
This is what I was working with
#include<stdio.h>
int main(){
int a=5;
printf("%d %d %d",a++,a++,++a);
return 0;
}
...
0
votes
1answer
34 views
Bash - working with ASCII so slow
I have a bash script that takes 2 arguments - a character and integer. I want to print chars in aplhabet starting with that character of length of that integer (modulo the alphabet)
#!/bin/bash
[[ ...
0
votes
0answers
18 views
Difference printf formatting for string/date/integer in unix?
can anyone explain to me the difference between '"%s"\n', "%s\n", "%d\n" and "%F\n"? If i want a string between quotes is it correct this one? '"%s"\n' and without quotes? Sorry but i can't ...
1
vote
4answers
38 views
Building formated strings in C
Lets say I have lots of printf usage, but I want to store them in a string and print them all in one go. Imagine the case below:
printf("%d,", _counter);
printf("IS REAL,", _condition);
printf("%f,", ...
0
votes
3answers
61 views
Strange behaviour of printf string format in C
I have the function below in nesCwhich is essentially same as C as far as I understood!
event void AdaptiveSampling.dataAvailable(error_t result, float val, bool isRealData)
{
if(result == ...
0
votes
1answer
38 views
How to replace | as input in PHP print_links
A member is now able to input Google|http://www.google.com (enter) Bing|http://www.bing.com (enter etc) to get nice looking links on his personal page. The output is li-ists with links: Google Bing... ...
2
votes
2answers
64 views
printf command causing a seg fault? [duplicate]
When I try to initialize a large double dimensional character array, it works perfectly fine. But when I add a simple print command, it gives me a segmentation fault. Any ideas as to why this is ...
1
vote
2answers
79 views
printf format for difference of two unsigned ints
In pure ANSI C (C89), I have the following.
unsigned y=<smallnumber>,x=y+3;
printf("%<whatgoeshere>\n",x-y);
What do I put after the % to be absolutely sure it will print 3? I can see ...
0
votes
2answers
32 views
Eclipse C/C++ printf() before scanf() issue
I'm a newbie to coding in C/C++. I'm using Eclipse and i'm struggling with what might be something pretty easy. In my code below I use printf() and after scanf(). Althougth printf is written before ...