Hi, from the result in my "for" loop, have stored four value.
How to extract that value to show the value(sprintf) ?

Kindly refer to the attached the image file.

Thanks

Regrads,
nazif

Recommended Answers

All 2 Replies

First of all the code for (a=4; a<5; a=a++) is undefined behaviour, you probably meant for (a=4; a<5; a++) which 'loops' a from 4 to 5 (essentially just running the loop once on the value a=4.

To use a value found inside the loop outside of it, it must be declared outside of it. Therefore your intended code was likely:

while (1) {
    <type> result;
    for (...) {
        ...
        result = ...;
    }
    //use result here all you want
}

Thank you Labdabeta

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.