Questions tagged [specifier]

59 questions
2
votes
3 answers

C printf function specifier

I need to print out a float value with 16 significant digits. Right now when I print, it prints out i.e 2.555556 when I want it to print out: 2.555555555555556 /// A total of 16 digits My printf specifier currently is : "%20.18lf" ideas?
user1050632
  • 680
  • 4
  • 13
  • 26
2
votes
2 answers

C language: How to access individual format specifiers in a printf format string?

I have a format string say char *format = "hello %d world %d" and an array int array[2] = {10, 20}; with me. This is just for example sake, the number of values to be printed in the array can be arbitrary, a max-sized array with a count of the…
Gopa
  • 33
  • 4
2
votes
1 answer

printf "%n" specifier not working properly

I copied this code from geeks for geeks. #include int main() { int c; printf("geeks for %ngeeks ", &c); printf("%d", c); getchar(); return 0; } It should print the characters from start to %n followed by the number of printed…
AhmetEnesKCC
  • 69
  • 2
  • 8
2
votes
1 answer

C float or double in printf format specifier and pow function

#include #include int main(void){ printf("%lf\n", pow(1.0, 2.0)); printf("%f\n", pow(1.0, 2.0)); return 0; } First printf() gives output 0.000000 but second printf() gives output 1.000000. Why? Using Codeblocks on…
AlexQualcosa
  • 467
  • 6
  • 11
2
votes
1 answer

Using format specifiers on Linux system call write()

I am trying to write to stdout using only Linux system calls described in section 2 of the manual (http://man7.org/linux/man-pages/dir_section_2.html). ssize_t write(int fd, const void *buf, size_t count); is the function I am trying to use,…
adhdj
  • 352
  • 4
  • 17
2
votes
3 answers

Treating 0 as a significant figure in printf %g format specifier

I'm trying to print floating point numbers 1.2345678, 0.1234567, 123.45678 using printf in such a way that only the first n characters are printed. I want these number to line up. The %g format specifier in printf("%*g", n, var) does this but the…
user3091673
2
votes
1 answer

Multiplying numbers in C

I have written the following code to multiply two numbers and I see the result to be incorrect. I assume the data type is not holding the value right. But the answer its printing is incorrect. #include main() { long int val1,val2; …
Koneri
  • 297
  • 3
  • 10
  • 27
2
votes
2 answers

string specifier ( %d , %f etc...)

#include #define Type int int main() { Type x=3; printf("%d",x); return 0; } The code is simple and works fine. My question is, if I change #define Type int to #define Type float so , I have to change %d to %f…
2
votes
1 answer

What is the correct string specifier for _cmd?

I use %s for _cmd, the latest XCode will generate an error "Format specifies type char * but the argument has type SEL". Checked documentation and couldn't find a clue. Anyone know the correct string specifier to use?
lichen19853
  • 1,410
  • 2
  • 14
  • 21
1
vote
1 answer

VUE/VITE Problem: Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../"

I passed last few days on searching the answer to my problem but nothing helps. I deployed my SPA made in Vite/Vue on GH Pages. Locally all works fine, on the deployed page there is an error: Uncaught TypeError: Failed to resolve module specifier…
1
vote
0 answers

Uncaught (in promise) Error: Unable to resolve bare specifier '@microsoft/signalr'

I want to use signalR in RazorPages web In typescript file: import * as signalR from "@microsoft/signalr"; Create a connection to hub. const connection = new signalR.HubConnectionBuilder() .withUrl("/hub") …
Thang07
  • 11
  • 2
1
vote
3 answers

two or more data types in declaration specifiers

I've looked around and tried a few things, nothings working at the moment. main.c:13: error: two or more data types in declaration specifiers make[1]: *** [main.o] Error 1 make: *** [build] Error 2 My code is pretty much this(i've commented…
Sman
  • 11
  • 1
  • 2
1
vote
1 answer

Expected specifier-qualifier-list before error

#import #import "NotepadViewController.h" #import "NotesTableViewController.h" #import "NoteInformationTransferProtocol.h" @interface NotesViewController : UIViewController { UITextField…
user810606
1
vote
2 answers

C preprocessor define to replace string format specifier

I am wondering if it's possible to use a C pre-processing define to change a string format specifier. I've tried writing the following, but seem to get a compiler error. It's simply trying to replace the existing format specifiers with the correct…
1
vote
1 answer

Don't ignore whitespaces when using wscanf for UTF-8

I am trying to read wide charaters into an array of wchar_t from stdin. However, the negated scanset specifier ([^characters]) for ls does not work preperly as expected. The goal is that I want every whitespace read into str instead of being…
Kevin Dong
  • 5,001
  • 9
  • 29
  • 62