From 45e5f0b74e010dbd369a40fe32681782e80c68e6 Mon Sep 17 00:00:00 2001 From: theSoberSobber <109434814+theSoberSobber@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:15:10 +0530 Subject: [PATCH] Create Inline-break.cpp --- codes/Inline-break.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 codes/Inline-break.cpp diff --git a/codes/Inline-break.cpp b/codes/Inline-break.cpp new file mode 100644 index 0000000..410c352 --- /dev/null +++ b/codes/Inline-break.cpp @@ -0,0 +1,16 @@ +//Inline Break +//Inline Break by defining break to a function that basically breaks but returns value and hence can be used as a expression with comma operator + +static inline int break_(void) { + extern void abort(void); + abort(); + return 0; +} +#define break break_ + +int main(int c, char **v) { + int yay = 1; + for (int i = 0; ++i < c;) + if (v[i][0] == '1') yay = 0, break; + return yay; +}