+ 5

Why does the following code work this way?

https://code.sololearn.com/c0arBA6nem4X/?ref=app Why is unknown replaced with "%s" and not as un"Sololearn"? Is there any order of precedence involved?

29th Oct 2018, 8:40 AM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
5 Respostas
+ 2
known and unknown are different macros. i. e. different keywords
29th Oct 2018, 9:12 AM
code learner
code learner - avatar
+ 2
code learner Yeah but the thing is that the detection of keyword isn't simply replacing a word by spaces
29th Oct 2018, 11:46 PM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
+ 1
Yeah, I think delimiters (like, token parsing) is taking precedence here. Research area seems like "compiler design", but there may be an official name like...lexicon or lexical analysis or something. Anyway, interesting question...I'm used to thinking about this in the "dev as consumer" way, and I think this is the type of question a compiler designer would be asking.
29th Oct 2018, 4:51 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
I don't feel there is an order of precedence because when I switched the order of macro definitions I get the same output
29th Oct 2018, 11:48 PM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
0
It's blank. #include <stdio.h> int main() { return 0; }
30th Oct 2018, 8:10 PM
bloogers
bloogers - avatar