🐰🐾 سمیه
int main ( int argc, char * argv[ ] ) { ... } in the above example, argv is an array of pointers , *argv points to the program name, and *++argv points to the first argument string.
🐰🐾 سمیه
and here ar is an array of pointers, and why *++ar is invalid?
Ибраги́м
That's spamming.
🐰🐾 سمیه
dunno whatcha mean
Ибраги́м
Spamming: send the same message indiscriminately to (a large number of Internet users).
Ибраги́м
🐰🐾 سمیه
🐰🐾 سمیه
Ибраги́м
yes
What is Operator Precedence ?
Ибраги́м
🐰🐾 سمیه
I dunno exactly
🐰🐾 سمیه
don't beat around the bush please, just tell me why those two cases behave diffrently?
Ибраги́м
Have u learnt lvalues and rvalues ?
🐰🐾 سمیه
yes last night
🐰🐾 سمیه
but my question is why that works for argv, but doesnt work for ar
Ибраги́м
Because u are doing it wrong.
Ибраги́м
U don't iterate like that
Ибраги́м
And if u want to get the values simply use pointer or array notation.
🐰🐾 سمیه
I don't think so. char *argv[ ] is an array of pointers just as char *ar[ ] is, both contain pointers to strinngs. but the problem is: *++argv is valid for argv, but is invalid forv ar
Ибраги́м
Anonymous
Is it good to shift from windows to Ubuntu for programming android and web applications in future
Anonymous
???
Ибраги́м
Even if u write char *[] it gets adjusted to char**
Ибраги́м
🐰🐾 سمیه
Ибраги́м
Change ar to char** and be liberated.
Ибраги́м
And greeted with error
Ибраги́м
Lest I forget.
Ибраги́м
C standard states:
7 A declaration of a parameter as ``array of type'' shall be adjusted to ``qualified pointer to
type'', where the type qualifiers (if any) are those specified within the [ and ] of the
array type derivation. If the keyword static also appears within the [ and ] of the
array type derivation, then for each call to the function, the value of the corresponding
actual argument shall provide access to the first element of an array with at least as many
elements as specified by the size expression.
Ибраги́м
http://www.iso-9899.info/n1570.html#6.7.6.3p7
Ибраги́м
Well, this was discussed Yesterday
Ибраги́м
Dunno why u still surprised
Ибраги́м
Arrays decays to pointers in function parameters
🐰🐾 سمیه
ok thanx
Shahadat
/rules
itsmanjeet
In Python we have
String = "$1, $2"%(var1,var2...)
Is c have alternetive of this thing
Instead of sprintf
Anonymous
Actually we usually use f-strings
Anonymous
Or .format
Anonymous
Do you really mean C or just C++?
tenzen
hi I'm new here
Mat
Seems like you can't
Mat
MᏫᎻᎯᎷᎷᎬᎠ
Shahadat
can you suggest some c++ projects to take up as a beginner
Wim
Anonymous
/get ide
Pavel
sprintf is a good thing for simple formatting, but when it comes to even simpliest l10n it becomes useless. the way of formatting that was sent as python example is mutch better, but afaik there no such things even in STL in C++, not talking of C.
But it's a common problem, so there probably should be some libs for better string formatting
BinaryByter
there is one
BinaryByter
fmtlib its called
Wim
Taken he comes from python, sprintf might be the shortest and most simple step from it to get started, but I do agree its limited; I don't expect a newcomer to be into all various libraries available etc., I'd say learn first, expand later and don't overload with all kinds of externally available libraries as that might confuse and scare off newcomers
Pavel
👍
Wim
He referred to printf, but probably had the problem of it outputting instead of retrieving the resulting string back
BinaryByter
sprintf
BinaryByter
sprintf does what he wants but he doesnt want to use it (for some reason)
Wim
That he didn't say, he only said printf didn't work for him
Wim
Oh fuck
BinaryByter
Wim
You're right
BinaryByter
Wim
He said sprintf 😂
Wim
I thought he said printf
Wim
my bad whahahahaha
BinaryByter
xD
BinaryByter
let paypal sponsor you with some coffee 😉
Wim
But then again I had so many asking about it wanting sprintf because they only knew printf from their books ...
Wim
😂
Wim
Yeah I could use some whahahaha
BinaryByter
Hehehe
BinaryByter
You have a few millions on your account
BinaryByter
just let them pay for some
BinaryByter
😂
BinaryByter
what?
Mihail