Skip to main content
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

Nesting Of Function

 

C Permit Nesting Of Function Freely,In Nesting Of Function One Function Can Call Another Function, Which In Term Can Call Another Function.There Is No Limit On How Deeply Function Can be Nested.
The Order In Which Function Are Define In A Program And Order In Which They Get Called Need Not Necessary Be Same.

Nesting Of Function
Img Credit: Google Images

Example
-:

#include<stdio.h>
#include<conio.h>
main()
{printf("\n Hello,This Is Main");
fun1();
printf("\n Hello,We Are Back In Main");
getch();
}
fun1();
{printf("\n Hello,This Is fun1");
 fun2();
printf("\n Hello,We Are Back In fun1");
}
fun2();
{printf("\n Hello,This Is fun2");
}



<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $errors = array();

    // Validate First Name (must be at least 3 characters long)
    if (isset($_POST['first_name'])) {
        $first_name = $_POST['first_name'];
        if (strlen($first_name) < 3) {
            $errors['first_name'] = "First name must be at least 3 characters long.";
        }
    }

    // Validate Email
    if (isset($_POST['email'])) {
        $email = $_POST['email'];
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $errors['email'] = "Invalid email format.";
        }
    }

    // Validate Password (must be at least 6 characters long)
    if (isset($_POST['password'])) {
        $password = $_POST['password'];
        if (strlen($password) < 6) {
            $errors['password'] = "Password must be at least 6 characters long.";
        }
    }

    // Validate Confirm Password (must match the Password)
    if (isset($_POST['confirm_password'])) {
        $confirm_password = $_POST['confirm_password'];
        if ($password !== $confirm_password) {
            $errors['confirm_password'] = "Passwords do not match.";
        }
    }

    // If there are no validation errors, you can process the data further
    if (empty($errors)) {
        // Process the form data, save to the database, etc.
        // You can access the validated values using the $first_name, $email, $password, and $confirm_password variables here.
        // Example: $first_name, $email, $password, $confirm_password
    }
}
?>

Comments

Post a Comment

Please do not enter any spam link in the comment box.


Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey