language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HASHSIZE 3
struct nlist {
struct nlist *next;
char *name;
char *defn;
};
static struct nlist *hashtable[HASHSIZE];
unsigned hash(char *s);
struct nlist *lookup(char *s);
struct nlist *install(char *name, char *defn);
void undef(char *name);
void ... |
C | #include<stdio.h>
#define ABC DEF
#define GHI JKL
#define MAIN(content) int main() { content }
MAIN(
/*
a
*/
FILE*f=fopen("./Grace_kid.c", "w+");
char*a="#include<stdio.h>%c#define ABC DEF%c#define GHI JKL%c#define MAIN(content) int main() { content }%cMAIN(%c/*%c a%c*/%cFILE*f=fopen(%c./Grace_kid.c%c, %cw+%c);%cchar*... |
C | // gdt.c
// Written by Harry Rigg
// Installs the GDT
#include <kernel/init/gdt.h>
// Installs a GDT entry
void
install_gdt(int32_t index, size_t base, size_t limit, uint8_t access, uint8_t gran)
{
gdt[index].base_low = (base & 0xFFFF);
gdt[index].base_middle = (base >> 16) & 0xFF;
gdt[index].base_high = (base >>... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "my_library.h"
#include "song_library.h"
#define print_section(section) do{printf("\n\n================ " section " ================\n");}while(0)
int main(void)
{
struct my_library* library = library_create();
int i;
for(i = 0; i < MUSIC... |
C | #include <stdlib.h>
#include "parser/stmt.h"
#include "test.h"
void test_new_stmt() {
expr_t expr;
stmt_t *subject = new_stmt(&expr);
assert(subject->data == &expr);
assert(subject->type == EXPR);
}
void test_new_stmt_list() {
stmt_t *stmt = new_stmt(NULL);
stmt_list_t *subject = new_stmt_lis... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
int n;
void collatz(int n)
{
while(n != 1){
printf("%d ", n);
if(n % 2 == 1)
n = 3 * n + 1;
else
n = n / 2;
}
printf("%d\n", 1);
}
... |
C | /*
* File: main.c
* Author: Felipe Costa
*/
/*Cap4, ex15, proposto*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int menu;
float vlrInv, rend, vlrFinal;
printf("\n\t TIPO DESCRIÇÃO RENDIMENTO MENSAL");
printf("\n\t 1 Pou... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define A 3
int main()
{
/* sAlumno miAlumno = {4545,"Gigliotti",3} ;
printf("%d %s %0.2f",miAlumno.legajo,miAlumno.nombre,miAlumno.promedio) ;
return 0;
------------ Asi para mostrar yo el dato que introduzco --------... |
C | #include <stdio.h>
int numZeroes(int input);
int main(void){
int num_tests,N;
scanf("%d",&num_tests);
for(int i=0;i<num_tests;i++){
scanf("%d",&N);
printf("%d\n",numZeroes(N));
}
return 0;
}
int numZeroes(int input){
int zeroes = 0;
while(input){
zeroes+= input/5;
input/=5;
}
return zeroes;
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
char gender;
int f, l;
int out;
int temp1,temp2,temp3,temp4;
int c1,c2,c3,c4;
scanf("%c %d %d", &gender, &f, &l); //남녀 / f 와 l>
////////////////////////////////////////
if(gender == 'M'){
temp1 = (2 - f);
if(temp1 < 0) tem... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdio_ext.h>
#define max_length 30
#define max_base 20
typedef struct sudents
{
char *surname, *name, *patronymic;
union
{
struct
{
char *father, *mother, *brother;
} family1;
struct
{
char *father, *mother, *brother, *sister;
} fam... |
C | /**
******************************************************************************
* ļ: bsp_rtc.c
* :
* : V1.0
* д: 2017-03-30
* : RTCʵʱʱ
******************************************************************************
*/
/* ͷļ -----------------------------------------------------... |
C | #include "../../../test_common.h"
#include <semaphore.h>
#include <fcntl.h>
void runSuccess() {
char buf[] = "name";
//@ assert \valid(buf+(0..\block_length(buf)-1));
//@ assert \exists integer x; buf[x] == '\0';
sem_open(buf, O_CREAT);
}
void runSuccess1() {
char buf[] = "name";
//@ asse... |
C | /* HELLO.C -- Hello, world */
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#define MAXSIZE 10
typedef struct
{int data[MAXSIZE];
int top;
}SeqStack;
SeqStack *Init_SeqStack() /*ÿջ*/
{
SeqStack *s;
s=malloc(sizeof(SeqStack));
s->top=0; return s;
}
int Empty_SeqStack(SeqStack *s) ... |
C | #include <stdio.h>
int recur(int n){
if(n>0){
// printf("%d\n", n);
return n+recur(n-1);
}else{
return 0;
}
}
int hi(int n){
if (n<=0)
{
printf("BYE\n");
return 0;
}
else{
printf("HI!!!\n");
return hi(n-1);
}
}
int main(){
//Number example
int s=recur(5);
printf("%d\n", s);
// hi(5);
re... |
C | #include <stdio.h>
int NextPrime(int x);
int main ()
{
int Input;
int Prime;
int Remainder;
scanf("%d", &Input);
printf("%d=",Input);
for (Prime=2;Input!=1;)
{
if ( Input%Prime==0)
{
Input = Input / Prime ;
if (Input !=1)
printf("%dx",Prime);
else
printf("%d",Prime);
}
else
{
Prime=... |
C | #include <stdio.h>
int main(void) {
char str[32];
printf("Enter a text to the field ---> ");
gets(str);
printf("Your text is ---> %s \n", str);
return 0;
}
|
C | #include <stdio.h>
#include<math.h>
#include "calculator_operations.h"
#define INT_MAX __INT_MAX__
const double PI=3.141592;
error_t add(arithmatic* data)
{
data->output=data->operand1+data->operand2;
return SUCCESS;
}
error_t subtract(arithmatic* data)
{
data->output=data->operand1-data->operand2;
return... |
C | #include <stdio.h>
#include <stdlib.h>
#include "cmd_line.h"
#include "geometry.h"
#include "postscript.h"
#include "matrix.h"
#include "xpm.h"
//Compile and run with:
//gcc *.c -o CG_hw1 -lm && ./CG_hw1
//PS file cmd line arg
extern char * ps_file;
extern float scale;
extern int rotation_cc;
extern int trans_x;
exte... |
C | //Created by Shamit Mani
//Created on 16/04/2017
#include <stdio.h>
void get_bounding_box(int height, int width, int pixels[height][width],
int *start_row, int *start_column, int *box_height, int *box_width) {
int i, j;
int box_width_count[width], box_height_count[height];
*box_height = 0;
*... |
C | /*
* Copyright 2022 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/drivers/disk.h>
#include <zephyr/sd/mmc.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#define SECTOR_COUNT 32
#define SECTOR_SIZE 512 /* subsystem should set all cards to 512 byte blocks */
#d... |
C | /*
* Exercise 3-6. Write a version of itoa that accepts three arguments instead
* of two. The third argument is a minimum field width; the converted number
* must be padded with blanks on the left if necessary to make it wide enough.
*/
#include <stdio.h>
#include <string.h>
int reverse(char* s) {
int len;
int... |
C | //-----------------------------------------------declaration------------------------------------------------------------------//
// functions for creating interface
void createInterfaceDinosaur(int firstColor);
// functions for printing and deleting objects
void printGameOver();
void printGround(char ground[3][121], ... |
C | #include "ft_ls.h"
char *get_file_name(char *path)
{
char *file_name;
file_name = ft_strrchr(path, '/');
if (file_name == NULL)
return (path);
return (file_name + 1);
} |
C | //linear search
#include<stdio.h>
int Linear_Search(int a[],int x,int item)
{
int i,flag=0;
//printf("data for search %d\n",item);
for(i=0;i<x;i++)
{
if(a[i] == item)
flag = 1;
}
if(flag == 1)
return 1;
}
void main()
{
int a[10],n,i,data,s;
pr... |
C | #include <stdio.h> // getchar(), putchar()
int main()
{
/*
1. Introduce getchar(), putchar()
2. Use while loop to process character sequence
3. Filter a specific character
4. Convert numbers to asterisks
5. Lower characters to Upper characters
*/
char ch;
//ch = (char)getchar();// buffer
//putchar(ch)... |
C | #include<stdio.h>
#include<stdlib.h>
int main(){
pid_t pid;
int i;
pid=fork();
if(pid<0){
printf("fork() error\n");
exit(1);
}
else if(pid==0){
printf("this is child :pid= %d parent pid=%d\n",getpid(),getppid());
}
else{
printf("this is parent:pid=%d, parent pid=%d\n",getpid(),getppid()... |
C | #include <stdio.h>
#include <stdlib.h>
/**
* _strdup? (- create array)?
*
* @s: input int array size
* Return: z
*/
char *_strdup(char *s)
{
char *z;
unsigned int i, j;
if (s == NULL)
return (NULL);
for (j = 0; s[j] != '\0'; j++)
;
z = malloc(sizeof(char) * j + 1);
if (z == NULL)
return (NULL);
for (i = 0;... |
C | #include "util.h"
void Util_Increase( uint16_t * const psrc, uint8_t delta, uint16_t max ) {
if ( ( *psrc ) + delta < max ) {
( *psrc ) += delta;
} else {
( *psrc ) = max;
}
}
void Util_Decrease( uint16_t * const psrc, uint8_t delta, uint16_t min ) {
if ( ( *psrc ) > min + delta ) {
( *psrc ) -= delta;
} e... |
C | #include <stdlib.h>
void func2(char *);
void func1()
{
func2(NULL); //DEFECT
}
void func2(char *var)
{
*var = 2;
} |
C | #include <stdio.h>
#include<string.h>
int main()
{
char s1[9],s2[9];
scanf("%s",s1);
strcpy(s2,s1);
strrev(s2);
if(strcmp(s2,s1)==0)
printf("the given sting is palindrome");
else
printf("no");
return 0;
}
|
C | /** I N C L U D E S **********************************************************/
#include <p18f4550.h> // PIC Controller header file
#include <adc.h> // ADC library functions
#include <xlcd.h> // LCD library functions
#include <delays.h> // Delay library functions
#include <stdio.h> ... |
C | #include <stdlib.h>
#include <stdio.h>
#include "rpc_channel.h"
#include "map.h"
#include "mp_channel.h"
#include "precondition.h"
#include "condition.h"
#include "amoeba.h"
#include "thread.h"
#include "assert.h"
#define MODULE_NAME "RPC_CHANNEL"
#define STACKSIZE 32000
static int me;
static int group_size;
static ... |
C | /*T
requires: veccuda
T*/
#include <petscvec.h>
static char help[] = "Tests vecScatter Sequential to Sequential for (CUDA) vectors\n\
-m # : the size of the vectors\n \
-n # : the numer of indices (with n<=m)\n \
-toFirst # : the starting index of the output vector for strided scatters\n \
-toStep #... |
C | /*
Octubre 14 de 2021
Aaron Sarmiento
Programa en C que evalua cual es el mayor entre dos numeros o indica si los numeros son iguales
*/
#include<stdio.h>
int main(){
//declaración inicial de las variables
int numero1, numero2;
//se pide introducir los números que desea evaluar
printf("******************... |
C | #include <stdio.h>
int main()
{
int a,b;
float c,d;
long e,f;
unsigned int u,v;
char c1,c2;
scanf("%d,%d",&a,&b);
scanf("%f,%f",&c,&d);
scanf("%d,%d",&e,&f);
scanf("%o,%o",&u,&v);
getchar();
scanf("%c,%C",&c1,&c2);
printf("\n");
printf("a=%7d,b=%7d\n",a,b);
printf("c=%10.2f,b=%10.2f\n",c,d);
pri... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #ifndef _T_SYSLOG_H_
#define _T_SYSLOG_H_
#include <stdarg.h>
#include <stdio.h>
#define LOG_ERROR 1
#define LOG_WARNING 1
#define LOG_NOTICE 1
static inline void syslog(int flag, const char* fmt, ...)
{
va_list arg_ptr;
static char format[1024];
sprintf(format, "%s\n", fmt);
va_start(arg_ptr, fmt);
... |
C | //
// Created by Pedro on 01-06-2019.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
///////////////////////////// PARTE A /////////////////////////////////////////////////////////////////////
// Questao 1
void strrev (char s[]) {
int i, j;
char guarda;
for (i = 0; s[i]... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
int main(void)
{
pid_t child;
int status,retval;
child = fork();
if(child<0){
perror("fork");
exit(EXIT_FAILURE);
}
else if(child == 0){
printf("i am child process\n");
sleep(1000);
exit(EXIT_SUCCESS... |
C | #include<stdio.h>
#include<math.h>
int main(void)
{
int n, i1, j1;
printf("Please input n:");
scanf("%d", &n);
for (i1 = 0; i1 < 2 * n - 1; i1++)
{
for (j1 = 0; j1 < 2 * n - 1; j1++)
{
if (j1 == i1)
{
printf("@");
}
else if (j1 + i1 - 2 * (n - 1) == 0)
{
printf("@");
}
else
{... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
struct Node *CreateNode(int data)
{
struct Node *n; //creating the node pointer
n = (struct Node *)malloc(sizeof(struct Node)); //Allocating the mem... |
C | #include<stdio.h>
#define bool int
bool ispower(int n)]
{
if(n==0)
return 0;
while(n!=1)
{
if(n%2==0)
{
return 0;
n=n/2;
}
return 1;
}
int main()
{
ispower(31)?printf("yes\n"):printf("no\n");
ispower(64)?printf("yes\n"):printf("no\n");
return 0;
... |
C | # include <stdio.h>
# include <stdlib.h>
# include <stdbool.h>
# include <argp.h>
bool is_valid_url(char *url) {
return false;
}
bool is_url_in_db(char *url) {
return false;
}
int add_url(char *url){
return EXIT_FAILURE;
}
// Notice that there is no visible call to this function.
// This is because `par... |
C | /*
* File: color.c
* Brief: Print colorful message to console
* Created on 18.11.2019
* (c) MIPT 2019
*/
#include <Windows.h>
#include <stdio.h>
#include "color.h"
/* This structure is not in header file, because it won't be shared */
typedef struct _CONSOLE_COLOR
{
HANDLE hConsole;
WORD saved_attributes;
}... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /**
* @file piano.h
* @author Phi Luu
* @date April 22, 2016
*
* @brief UTAustinX: UT.6.03x Embedded Systems - Shape the World
* Lab 13: Digital-Analog Conversion
*
* @section DESCRIPTION
*
* Takes inputs from switches and decides what note to output to the buzzer.
* Port E, bits 3-0 ... |
C | #include "Quantizer.h"
#include <stdio.h>
#define MAXCOLOR 256
#define RED 2
#define GREEN 1
#define BLUE 0
struct box {
int r0; /* min value, exclusive */
int r1; /* max value, inclusive */
int g0;
int g1;
int b0;
int b1;
int vol;
};
/* Histogram is in elements 1..HISTSIZE along each axis,
* element 0 ... |
C | #include <stdio.h>
int main(){
long double a, koma;
long long int integer;
scanf("%llf", &a);
integer=(int)a;
koma=a-integer;
printf("%lld %.5llf\n", integer, a);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <sys/types.h>
int main()
{
int data_processed;
int file_pipes[2];
int status;
int fd;
const char some_data[]="123";
char buffer[BUFSIZ+1];
pid_t fork_result;
memset(buffer,'\0',sizeo... |
C | /*
** send.c for send in /home/tekm/tek2/PSU_2016_myirc
**
** Made by leroy_0
** Login <maxime.leroy@epitech.eu>
**
** Started on Wed May 24 16:21:47 2017 leroy_0
** Last update Fri Jun 9 16:11:35 2017 yan
*/
#include <string.h>
#include "myirc.h"
bool send_cmd(char **cmd, t_connect *client)
{
int x;
x ... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int **p=NULL;
int r,c,i,j;
printf("输入行和列");
scanf("%d%d",&r,&c);
p=(int**)malloc(r*sizeof(int*));
if(NULL==p)
{
printf("p:malloc error");
exit(0);
}
for(i=0;i<r;i++)
{
*(p+i)=(int*)malloc(c*sizeof(int));
if(NULL==*(p+i))
{
printf("p+i:malloc error... |
C | /*
* ship.h - Space ship implementation
*
* Authors: Rafael Roquetto
* Nicoli Gavassa
*/
#ifndef SHIP_H
#define SHIP_H
#include "beam.h"
#include "list.h"
#include "vector2d.h"
enum
{
RED,
GREEN,
BLUE,
RGB
};
struct ship
{
int x;
int y;
int beam_count;
int can_pulse;
int lives;
float angle;
float... |
C | /*********************************************************************************
* Copyright 2019 Huawei Technologies Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www... |
C | //
// compile.c
//
// Created on 2/4/18.
//
#include "javaclass.h"
#include "bytecode.h"
#include "global.h"
// Functions associated with Non-terminals
void stmt(void);
void opt_stmt(void);
void expr(void);
void term(void);
void factor(void);
void match(int);
// Utility functions
void add_ret(int); // add... |
C | /* Aranea
* Copyright (c) 2011-2012, Quoc-Viet Nguyen
* See LICENSE file for copyright and license details.
*/
#ifndef ARANEA_CLIENT_H_
#define ARANEA_CLIENT_H_
#include <aranea/types.h>
/** Allocate memory for a client.
*/
struct client_t *client_new();
/** Reset status of the client object to reuse it for ano... |
C | #include<stdio.h>
int heights[10000001], previous[10000001];
int main(){
int n, target, confort_level, cnt = 0;
scanf("%d %d", &n, &target);
int ans[n+1];
for(int i=1; i<=n; i++) {
scanf("%d", &heights[i]);
confort_level=0;
for(int j=i-1; j>=1; j--) {
if(hei... |
C | #include <stdio.h>
int isPalindrome(int num) {
int temp = num;
int reversed = 0;
while (temp) {
reversed *= 10;
reversed += temp % 10; // integer division
temp /= 10; // integer division
}
return num == reversed;
}
int main() {
int max = 0;
for (int a = 100; a <= ... |
C | //
// main.c
// Challenge 9.3
//
// Created by Wei on 7/6/15.
// Copyright (c) 2015 OO. All rights reserved.
//
// An unsigned short only hold non-negative numbers. What is the largest number that an unsigned short can store?
#include <stdio.h>
#include <limits.h> // for MAX function
int main(int argc, const cha... |
C | /*************************************************************
CS530 - SPRING 2013
Name: Linh Ngoc Nguyen
username: masc0755
Project: CSNNNN Assignment 2
Partner: Tuan Truong username :masc0710
*************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#in... |
C | /*!
Attribution.c
Authors: Gabriela Marques and Leonardo Mizoguti
Updated: 2015-10-28
*/
#include "Attribution.h"
/*!
@const ATTR_NEXT_STATE
@abstract Table indicating to which state the automaton must go given a current state and the value of the input token.
@discussion The lines in this ta... |
C | #include <stdio.h>
int power(int m, int n);
/* power */
main()
{
int i;
for (i = 0; i < 10; ++i)
printf("%d %d %d\n", i, power(2,i), power(-3,i));
return 0;
}
/* power: base n ; n >= 0 */
int power(int base, int n)
{
int i, p;
p = 1;
for (i = 1; i <= n; ++i)
p = p * base... |
C | #include "utils.h"
int ***malloc3Dmatrix(int bands, int rows, int cols, double nodata){
int ***m = (int ***) malloc(sizeof(int **) * bands);
for(int a = 0; a < bands; a++){
m[a] = (int **) malloc(sizeof(int *) * rows);
for(int r = 0; r < rows; r++)
m[a][r] = (int *) malloc(sizeof(int) * cols);
}
... |
C | #include <stdio.h>
#include <string.h>
// 8. Any integer is input from the keyboard. Write a function to reverse an integer and print
// using C language. For example if user enters 12323 then output should be 32321
int main(void) {
char digits[80];
char reversed[80];
printf("Enter any nonnegative integer: ");
s... |
C | #include<stdio.h>
int main(){
int num;
printf("enter the no of element of your array\n");
scanf("%d",&num);
int arr[num];
for(int i=0;i<num;i++){
printf("Enter element %d of array: \n",i+1);
scanf("%d",&arr[i]);
}
int min=arr[0],max=arr[0];
for(int i=0;i<num;i++){
if(min>arr[i]){
... |
C | /*
* synt_anal.h
* Autor: Tomas Zencak
* Predmet: Formalni jazyky a prekladace
* Projekt: Implementace interpretu jazyka IFJ15
* Varianta zadani: a/2/II
* Datum: 1. 10. 2015
* Prelozeno: gcc 4.8
* Tomas Zencak xzenca00
* Ondrej Vales xvales03
* Nikola Valesova xvales02
* Radek Vit xvitra00
*/
#ifndef SYNT_... |
C | #include "timer.h"
#define MICROSSECONDS_IN_SECONDS 1000000
/** Local function that returns the ticks
* (number of microsseconds) since the Epoch.
*/
static suseconds_t get_ticks()
{
struct timeval tmp;
gettimeofday(&(tmp), NULL);
return (tmp.tv_usec) + (tmp.tv_sec * MICROSSECONDS_IN_SECONDS);
}
void timer_sta... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Comments are fun");
}
/*L'ordinateur ne lit pas les commentaires, ils sont un peu pour nous, pour nous retrouves dans notre code ou juste un effet personnel, bref l'ordi ne lit pas les commentaires.*/
|
C | /*
* Copyright (c) 2019-2020 vanaur.
*
* This file is part of RCL
* (see https://github.com/vanaur/The-Runtime-Core-Library).
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* r... |
C | #include "header.h"
s_argument agv(const char *arg, s_argument result)
{
int index;
char c;
index = 1;
c = '\0';
if (arg[0] != '-' || strlen(arg) == 1)
erreur_fichier();
while (arg[index])
{
c = arg[index];
if (c != 'l' && c != 'R' && c!= 'a' && c != 'r' && c != 't'... |
C | #include<stdio.h>
#include<string.h>
int main(int argc, char *argv[]) {
char inbuf[4096];
unsigned char data[32768], *dst;
unsigned char testbuf[32768];
int i, j, k, len, hit;
//printf("hamming distance: %d\n", hamming_distance("this is a test", "wokka wokka!!!", 14));
while(fgets(inbuf, sizeof(inbuf), st... |
C | #include "holberton.h"
/**
*_print_X - print an integer in hexadecimal (uppercase) (helper function)
*@n: the integer to print
*@count: a pointer to a counter for the number of bytes printed
*/
void _print_X(unsigned int n, int *count)
{
int lastRetVal;
if (n > 0xf)
_print_X(n >> 4, count);
if (*count < 0)
return;... |
C | #include<stdio.h>
int main(){
char a[100];
int i;
printf("Enter the string: ");
gets(a);
for ( ; a[i] != '\0';i++){
if(a[i]>='A'&&a[i]<='Z')
a[i]=a[i]+32;
}
printf("Lower Case : %s",a);
return 0;
} |
C | //
// strchr.c
// break-away-coding-interviews
//
// Created by Vaibhav Chauhan on 3/5/16.
// Copyright © 2016 Vaibhav Chauhan. All rights reserved.
//
#include <stdio.h>
char * my_strchr( char * str, int c) {
if (str == NULL)
return NULL;
while (*str != '\0') {
if (*str == c){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "linkqueue.h"
ElementType Dequeue(linkqueue Q)
{
List tempNode;
ElementType item;
if(!Q->front)
{
printf("Queue is empty!\n");
return ERROR;
}
tempNode = Q->front;
if(Q->front ==Q->rear)
Q->front = Q->rear = NULL;
e... |
C | #include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main (void) {
int fd;
char buf[] = "mensaje 1...";
mkfifo("/tmp/mi_fifo", 0666); // 0666 = permisos de lectura y escritura
fd = open("/tmp/mi_fifo", O_WRONLY);
printf("Escribiendo mensaje...");
... |
C | #include <stdio.h>
int main(void) {
int num, grade, i;
int sum = 0;
double doubSum;
scanf("%d", &num);
for (i=0; i<num; i++){
scanf("%d", &grade);
sum = sum + grade;
}
doubSum = (double) sum;
printf("%.2lf", doubSum/num);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
void displayDataSet(int dataSet[], int length)
{
int i =0;
for(i=0;i<length;i++)
{
printf("%d ", dataSet[i]);
}
printf("\n");
}
void insertionSort(int dataSet[], int len)
{
int i =0;
int j= 0;
int value = 0;
for(i=1;i<len;i++)
{
displayDataSet(dataSet, len);
]
i... |
C | #define _CRT_SECURE_NO_WARNINGS
#include"SList.h"
//ӡ
void SListPrint(SLTNode** pphead)
{
SLTNode* cur = *pphead;
while (cur != NULL)
{
printf("%d->", cur->data);
cur = cur->next;
}
printf("NULL\n");
}
//һ½ڵ
SLTNode* BuySListNode(SLTDataType x)
{
SLTNode* newnode = (SLTNode*)malloc(sizeof(SLTNode));
newn... |
C | /*
** env.c for minishell in /home/raphael.goulmot/rendu/PSU_2016_minishell2
**
** Made by Raphaël Goulmot
** Login <raphael.goulmot@epitech.net>
**
** Started on Sat Apr 1 04:51:24 2017 Raphaël Goulmot
** Last update Sun Apr 9 17:11:51 2017 Raphaël Goulmot
*/
#include "utils.h"
#include <stdlib.h>
char my_is_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
#include <sys/msg.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
//#include "../include/alarm.h"
// arm-linux-gcc -o msgrcv msgrcv.c
type... |
C | char line[100],male;
int len;
void hand();
int main()
{
cin>>line;
len=strlen(line);
male=line[0];
hand();
return 0;
}
void hand()
{
int i,j;
for(i=0;i<len;i++)
{
if(line[i]!=male && line[i]!='\0')
{
for(j=i-1;j>=0;j--)
{
if(line[j]==male)
{
cout<<j<<' '<<i<<endl;
... |
C | #ifndef AN_BUF_H_
#define AN_BUF_H_
#include <unistd.h>
#include <stdbool.h>
/*
* An abstract buffer API.
*
* The backend specific headers (an_buf_<backend>.h) contain the
* functions required to create an an_[rw]buf object. Consumers should
* include the backend specific header they need instead of this one.
*... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "USAGE: %s <num_elems>\n", argv[0]);
exit(1);
}
int num = atoi(argv[1]);
printf("num = %d\n", num);
// create a dynamic array on the heap
int *a = malloc(num * sizeof(in... |
C | #include <stdio.h>
int main()
{
// 1.算术运算
printf("----1.算术运算----\n");
int a = 21;
int b = 10;
int c;
printf("a = %d, b = %d\n", a, b);
c = a + b;
printf("a + b = %d\n", c);
c = a - b;
printf("a - b = %d\n", c);
c = a * b;
printf("a * b = %d\n", c);
c = a / b;
printf("a / b = %d\n", c);
c = a % b;
prin... |
C | /*
Assignment 1
Name: Bilal Ayyache
Student Number: 0988616
UofG Email: bayyache@uoguelph.ca
*/
#define MAX_ELEMENTS 256
long elements;
int ds_create(char *filename, long size );
int ds_init(char *filename);
long ds_malloc(long amount);
void ds_free(long start);
long ds_write(long start, void *ptr, long bytes);
void ... |
C | /* ===================================================================================
Departamento Eng. Informatica - FCTUC
Computacao Grafica - 2015/16
................................................... PMartins/JArrais
Trabalho 1 - George Nelson's Asterisk Clock (codigo incompleto)
Completar as... |
C | /*
FILE: msss.c
UNIT: CNCO3002
PURPOSE: Listening for client connections and serving them.
REFERENCE:
[1] Curtin University.(AU). Worksheet 05(tcpserv01.c): Threads. In Advanced Computer Communications (Semester 2 2018 Sri Lanka Inst Info Tech - INT[1]). Retrieved from https://lms.curtin.edu.au
[2] Curtin Universi... |
C | #include <stdio.h>
static inline long sum_recursion(int n, int before_is);
int main(void) {
int num_food = 0, before = 0;
char *set = NULL;
long sum = 0;
scanf("%d", &num_food);
set = calloc(sizeof(char)*num_food);
printf("%ld\n", ret);
return 0;
}
/*
static inline long sum_recursion(int n, int before_is)... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "account.h"
int main(){
//在共享内存中创建银行账户
int shmid;
if((shmid = shmget(IPC_PRIVATE, sizeof(Account), IPC_CREAT | IPC_EXCL | 0777)) < 0){
perror("s... |
C | /* ************************************************************************** */
/* Nome: Hélio Hideki Assakura Moreira */
/* Numero USP: 8941064 */
/* EP3: Indice Remissivo */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.... |
C | #include<stdio.h>
int main()
{
int t,n,x,a[100],i,cst,w,flag;
scanf("%d",&t);
while(t--)
{
cst = 0;
flag = 0;
scanf("%d %d",&n,&x);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
cst += a[i];
}
w = cst % x;
for(i=0;i<n;i++)
{
if(w >= a[i])
{
pr... |
C | #include <stdio.h>
void swap(int *px, int *py)
{
int temp = *px;
*px = *py;
*py = temp;
}
int main(void)
{
int na, nb;
puts("enter two integers:");
printf("A:"); scanf("%d", &na);
printf("B:"); scanf("%d", &nb);
swap(&na, &nb);
puts("swapped the two integers");
printf("i... |
C | #include<stdio.h>
#include<locale.h>
main()
{
int n1, n2, quociente, resto;
setlocale(LC_ALL, "Portuguese");
do{
if(n1<0)
printf("Valor invlido...");
printf("Digite um nmero natural: \n");
scanf("%i", &n1);
}
while(n1<0);
do{
if(n2<2)
printf("Valor invlido...");
printf("Digite outro nmero natural: \n");
... |
C | #include "funciones.h"
int MostrarMenu(float numberA, float numberB)
{
int options;
printf("CALCULADORA\n");
printf("1- Ingresar 1er operando. A=%2.f\n",numberA);
printf("2- Ingresar 2do operando. B=%2.f\n",numberB);
printf("3- Calcular todas las operaciones.\na) Calcular la suma (A+B)\nb) Calcular... |
C | #include <stdio.h>
#include "hash.h"
typedef enum{false, true} bool;
bool hashApproach(HashInt *hash, int flightLength, int nMovies, int *movies, int *firstMovie, int *secondMovie);
int main(){
// Gather input
printf("How much time will the flight take? (in minutes)\n");
int flightLength;
scanf("%d"... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#define SLEEP_TIME 1
#define KEY_PATHNAME "/tmp/mqueue_server_key"
#define PROJECT_ID 'M'
#define Q_PERMISSIONS 0666
//Un productor que envía un mensaje
//random con una ta... |
C | #include<stdio.h>
int main()
{int x,y;
printf("x");
scanf("%d",&x);
if(x<1) //x<1
{y=x;
printf("x=%3d,y=x=%d\n",x,y);
}
else if(x<10) //1=<x<10
{y=2*x-1;
printf("x=%d,y=2*x-1=%d\n",x,y);
}
else //x>=10
{y=3*x-11;
printf("x=%d,y=3*x-11=%d\n",x,y);
}
return 0;
} |
C | /*
** Bit set, clear, and test operations
**
** public domain snippet by Bob Stout
*/
typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL;
#define BOOL(x) (!(!(x)))
#define BitSet(arg,posn) ((arg) | (1L << (posn)))
#define BitClr(arg,posn) ((arg) & ~(1L << (posn)))
#define BitTst(arg,posn) BOOL((arg) & (1L ... |
C | #include <stdio.h>
/*
条件分岐
*/
int main(void){
int score = 30;
if(score >= 60){
printf("60以上\n");
}else{
printf("赤点!");
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.